我可以在复选框中使用 ng-readonly 指令吗?
该复选框即使在使用 ng-readonly 修饰后也是可写的。
html:
<input type="checkbox" ng-model="model" ng-readonly="test" /> {{model}}
Controller :
myApp.controller('MyCtrl', function($scope) {
$scope.test = true;
});
已添加 Fiddle
最佳答案
如果你想让它“更多”可见,你总是可以使用一点 javascript 技巧:
<input type="checkbox" ng-model="model" onclick="return false;" />
关于angularjs - ng-readonly 在 Angular 复选框中不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33777710/