When my checkbox is clicked the value of my ngModel
produto.checked
is set to true
, but in a moment this value is changed to false without a click in the checkbox. How can i make my checkbox only check/uncheck according by my ngModel
?
I try something like:
<tr *ngFor="let produto of sortedDataProduto; let i = index">
<input [checked]="produto.checked" [(ngModel)]="produto.checked" name="checkedproduto{{i}}" type="checkbox">
</tr>
Delete from your code [checked]="produto.checked
". [(ngModel)]="produto.checked"
is enough to show initial value.
You are binding your produto.checked
twice use either [checked]
or [(ngModel)]
if you still have problem please be more specific.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.