默认情况下选中Checkbox angularjs 1.6材质

时间:2018-04-23 11:04:45

标签: angularjs

我正在尝试使用材质角度复选框,并默认将其设置为已选中,但显示未选中,出现了什么问题?

<md-checkbox ng-model="loan.currentAsPermanent" aria-label="Checkbox 1" [checked]="isChecked" aria-checked="true"/> Permanent address same as current address </md-checkbox>

3 个答案:

答案 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;