Praveen Prasannan Praveen Prasannan - 1 year ago 591
AngularJS Question

ng-readonly not working in angular checkbox

Can I use ng-readonly directive in a checkbox?

The checkbox is writable even after it is decorated with ng-readonly.


<input type="checkbox" ng-model="model" ng-readonly="test" /> {{model}}


myApp.controller('MyCtrl', function($scope) {
$scope.test = true;

Added Fiddle

Answer Source

if you want to disable it use this:

<input type="checkbox" ng-disabled="true" ng-model="test" /> test
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download