Angular.js (1.x) had ng-true-value and ng-false-value, which was convenient to avoid conversions between the web form and an inflexible backend:
<input type="checkbox" ng-model="vv[name]" ng-true-value="'1'" ng-false-value="'0'"/>
Angular 2+ has the banana-in-a-box notation to bind directly to the model, but that data type must be boolean to work with a checkbox:
<input type="checkbox" [(ngModel)]="vv[name]"/>
If you really can't use booleans, the [checked] and (change) notation is a workable substitute (in this case, 1 is true, 0 is false):
<input type="checkbox" [checked]="vv[name]==='1'"
(change)="vv[name]=$event.target.checked?'1':'0'"/>
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…