AngularJS Tutorial - ng-readonly








We can use ng-readonly to control readonly attribute.

Example

The following code shows how to ng-readonly.


<!doctype html>
<html ng-app="myApp">
<head>
  <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.0-rc.3/angular.js"></script>
</head><!--from  w  w w. ja va2s .  c  o  m-->
<body>
  Type to make input readonly: <br/>
  <input type="text" ng-model="isReadOnly"><br/>
  <input type="text" ng-readonly="isReadOnly" value="Some text here"/>

  <script>
    angular.module('myApp', [])
  </script>

</body>
</html>

The code above is rendered as follows: