应始终选中复选框

时间:2018-03-28 14:04:10

标签: javascript html angular checkbox

我有一个复选框,我想要一直检查,只有在我们愿意的情况下才能取消选中。

这是html

<input type="checkbox" 
    class="custom-control-input" 
    [(ngModel)]="productDetails.iscanRetrunable" 
    name="iscanRetrunable" checked>

是因为我对它有约束力吗?

1 个答案:

答案 0 :(得分:-1)

可行,但您必须将起始reduce绑定值初始化为true:

ngModel

see this example