Reputation: 31
I'm busy with the 'Angular - The Complete Guide (2021 Edition)' on Udemy and have run into a bit of an issue:
I keep getting the following error: TS2339: Property 'controls' does not exist on type 'AbstractControl' I'm working with the latest version of Angular.
Here is my HTML code:
<div class="row" *ngFor="let ingredient of recipeForm.get('ingredients').controls; let i = index"
[formGroupName]="i" style="margin-top: 10px;">
<div class="col-xs-8">
Any advise will be much appreciated! Thanks!
Upvotes: 1
Views: 962
Reputation: 11
<div
class="row"
*ngFor="let ingredientCtrl of recipeForm.get('ingredients')['controls']; let i = index"
[formGroupName]="i"
style="margin-top: 10px;">
// just use ['Controls'] instead of .Controls
Upvotes: 1