Когда я добавляю один продукт в свою форму, покажите эту ошибку. Мой код тс:
this.products = this.ps.getProduct();
this.addform = this.fb.group({
'invoice_number': new FormControl('', [Validators.required, Validators.nullValidator]),
'Subtotal': new FormControl('', Validators.required),
'products': this.fb.array([
]),
'total': new FormControl('', Validators.required),
});
Класс модели:
export class Sale {
invoice_number: number;
products: Products[];
}
Мой HTML-код:
<form [formGroup]="addform" (ngSubmit)="onaddsale()">
<div class="contant">
<div class="row">
<div class="input-field col s4">
<input formControlName="invoice_number" id="invoice_number" type="text" class="validate">
</div>
</div>
</div>
<tr formArrayName="products" class="group" style="cursor: pointer" *ngFor="let item of products; index as i" [formGroupName]="i">
<td>
<input formControlName="Subtotal" [(ngModel)]="item.Subtotal" readonly type="number" />
</td>
<td>
<input formControlName="total" [(ngModel)]="item.total" readonly type="number" />
</td>
</tr>
</form>
В моем HTML ничего не отображается, также покажите мою ошибку в консоли.
Не подскажете, в чем проблема, как решить?