Ng-Readonly-1

 

When we click on the checkbox its value bind to open variable which will assign to ng-readonly directive then textbox become readonly.

 
 
 
<!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title></title> <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.2/angular.min.js"></script> </head> <body ng-app> <div> <label>Check me : <input type="checkbox" ng-model="open"></label><br /> Name:<input ng-readonly="open" type="text" ng-model="name"> </div> </body> </html>
Output