feat: add form dialog component (#428)

- Add formfield, input, select base (model)
- Add formfield component
- Add form-group service
- Add form-dialog component

Fixes: #427
This commit is contained in:
Abhay Chawla
2019-12-01 23:20:51 +03:00
parent 6001446310
commit f616145a6b
14 changed files with 257 additions and 0 deletions
@@ -0,0 +1,23 @@
import { Injectable } from '@angular/core';
import { FormControl, FormGroup, Validators } from '@angular/forms';
import { FormfieldBase } from './formfield/model/formfield-base';
@Injectable({
providedIn: 'root'
})
export class FormGroupService {
constructor() { }
createFormGroup(formfields: FormfieldBase[]) {
const group: any = {};
formfields.forEach(formfield => {
group[formfield.controlName] = formfield.required ? new FormControl(formfield.value, Validators.required) : new FormControl(formfield.value);
});
return new FormGroup(group);
}
}