我正在尝试使用材质角度复选框,并默认将其设置为已选中,但显示未选中,出现了什么问题?
<md-checkbox ng-model="loan.currentAsPermanent" aria-label="Checkbox 1" [checked]="isChecked" aria-checked="true"/> Permanent address same as current address </md-checkbox>
答案 0 :(得分:0)
根据文档使用ng-model
<md-checkbox aria-label="Checkbox 1" ng-model="isChecked" aria-checked="true"/> Permanent address same as current address </md-checkbox>
参考。来自official Docs
答案 1 :(得分:0)
按[checked]="isChecked"
ng-model="isChecked"
或保留ng-model="loan.currentAsPermanent"
并检查loan.currentAsPermanent
是否为真
答案 2 :(得分:0)
<md-checkbox ng-model="loan.currentAsPermanent" aria-label="Checkbox 1">
Permanent address same as current address</md-checkbox>
在控制器中添加此代码
$scope.loan = {};
$scope.loan.currentAsPermanent = true;