{
id: 123,
email: "[email protected]",
password: 108,
myObj:[
{ id:1, name:"abc", age: 20 },
{ id:2, name:"def", age: 21 },
{ id:3, name:"ghi", age: 22 },
{ id:4, name:"jkl", age: 23 } ]
}
This is how I'm getting the fields from the server to patch, I'm patching them like this :
this.myForm = this.fb.group({
id: [],
email: [],
password: [],
myObj: []
});
And I need each of myObj Array to be a separate form control.
I tried to access them from the HTML in different ways, (like formControlName = myObj[0] , formControlName = myObj.name
) but no success..
How can I access myObj fields in the HTML?
myObjshould be formArray, isn't it?this.myForm = this.fb.group({ id: [], email: [], password: [], myObj: this.fb.array([]) });but then how do I access it from HTML? as I saidformControlName = myObj[0]andformControlName = myObj.namedoesn't work..