AngularJS ng-readonly Directive

Last Updated : 11 Jul, 2025

The ng-readonly Directive in AngularJS is used to specify the readonly attribute of an HTML element. The HTML element will be readonly only if the expression inside the ng-readonly directive returns true. The ng-readonly directive is required to change the value between true and false. In case, if the readonly attribute is set to false, then the presence of the readonly attribute makes the element readonly, irrespective of its value.

Syntax:

 
Contents...

Parameter:

  • expression: It returns true if the expression sets the element's readonly attribute.

This directive is supported by ,