I'm using the reactive forms module in Angular 2 to create a form with several nested groups.
My 'trust' form has an array of contacts at
<FormArray>this.newTrustForm.controls['contact']
One of the fields in the 'contact' group is an array of 'email' groups and I tried finding it here, but alas, no. Where would I then find it?
<FormArray>this.newTrustForm.controls['contact'].controls['email']
I setup my form with the following.
constructor(private _fb: FormBuilder) { }
ngOnInit() {
this.newTrustForm = this._fb.group({
...
contact: this._fb.array([]),
...
});
}
I then add 'contact' groups with the following.
initContact() {
return this._fb.group({
...
email: this._fb.array([]),
...
});
}
And then I have initContactEmail setup in the same way.