I want to access the object properties and bind values from a form. So far i have tried different options but no success. This is what i have so far, i have simplified the code below:
The FormGroup:
this.form = this.fb.group({
ingredients: new FormArray([this.fb.group({name: 'Pasta', price: ''})])
})
The View code:
<div formArrayName="ingredients">
<ion-item *ngFor="let ingredient of form['controls'].ingredients['controls']; let i = index" padding-bottom>
<div [formGroupName]="i">
<ion-input formControlName="price" type="number"></ion-input>
</div>
</ion-item>
</div>
The code above is simplified for this question purpose, the scenario is different but at the end ends up like this where i want to update the price value inside the object. I have seen a lot of ways of doing it while i did my research but nothing seems to work for me.