I have a data driven form in angular2 like below
this.formBuilder.group({
\'name\': [\'\',Validators.required],
\'description\': [\'\', Validators.required],
if you are trying to add validation to formarray try this may help you,
this.formBuilder.group({
'name': ['',Validators.required],
'description': ['', Validators.required],
'places': this.formBuilder.array(this.initPlaces())
})
initPlaces() {
return this._fb.group({
places: ['',[Validators.minLength(1)]]
});
}
this initPlaces
will simply return formGroup with validation as per requirement.