我有一个包含多个离子复选框的表单,我想让它只读。
基于this answer我在字段集中添加了一个布尔值。它适用于选择和文本框。但是离子复选框虽然看起来已禁用,但仍会触发点击事件并切换其状态
<form>
<fieldset ng-disabled="myBooleanValue">
<!-- selects and textboxes are all disabled as you'd expect-->
<ion-checkbox ng-repeat="va in q.ValidAnswers | orderBy:'SortOrder'"
ng-click="vm.setAnswer(q.ID, va.AnswerID)"
ng-checked="vm.isChecked(currentAnswers, va.AnswerID)">
{{va.Text}}
</ion-checkbox>
</fieldset>
</form>
答案 0 :(得分:1)
将select
添加到ng-disabled
:
ion-checkbox
添加<ion-checkbox ng-disabled="myBooleanValue"
ng-repeat="va in q.ValidAnswers | orderBy:'SortOrder'"
ng-click="vm.setAnswer(q.ID, va.AnswerID)"
ng-checked="vm.isChecked(currentAnswers, va.AnswerID)"> {{va.Text}}
</ion-checkbox>
:
ng-click="myBooleanValue || ..."