我有一个问题,在我的表中我想使用formControlName,但不是输入表单。 Subtotale
我不会在ws中发帖,因为此值为空,就像在照片中一样。如何在此代码中使用formControlName?你能告诉我什么想法吗?
<table align="center" class="table table-bordered table-hover">
<thead>
<tr style="color:black;">
<th>Name</th>
<th>Note</th>
<th>Subtotale</th>
</tr>
</thead>
<tbody>
<tr class="group" style="cursor: pointer" *ngFor="let item of products;">
<td>{{item.client_id}}</td>
<td>
<div class="input-field col s2">
<label for="notes">Notes:</label>
<input formControlName="notes" id="notes" type="text" lass="validate">
</div>
</td>
<td>
{{100 * item.Quantity}} // I should use formControlName but do not know how to use it. I do not want input. Is there any way you can solve it?
</td>
</tr>
</tbody>
</table>
ts代码:
this.addprod= new FormGroup({
'client_id': new FormControl('', Validators.required),
'notes': new FormControl('', Validators.required),
'subtotal': new FormControl('', Validators.required)
});
答案 0 :(得分:1)
this.profile = this.fb.group({
title : [null, [Validators.required]],
nickName : [null, []],
firstName: [null, [Validators.required]],
lastName : [null, []]
})