Contact Model,
interface Contact {
name:string;
age:number;
}
Contact component, contacts array initialized with values ,
export class ContactComponent {
contacts: Contact[] = [{name:'xyz', age:30}, {name:'abc', age: 25}];
contactForm: FormGroup;
constructor(private fb: FormBuilder) {
this.contactForm = this.fb.group({
contacts: this.fb.array([this.createContact()])
});
}
createContact(): FormGroup {
return this.fb.group({
???????? - How can initialize values here.
});
}
}
Any other better way of designing it?