Home » AngularJS ng-readonly Directive

AngularJS ng-readonly Directive

by Online Tutorials Library

AngularJS ng-readonly Directive

The AnglarJS readonly directive sets the readonly attribute on the element; if it gets that the expression inside ng-readonly is true.

It is only applied to input elements with specific types. The ng-readonly directive is necessary to enable to shift the values between true and false. In HTML, readonly attributes cannot be set to false.

It is supported by <input> <textarea> elements.

Syntax:

Parameter explanation:

expression: It specifies an expression that will set the element’s readonly attribute if it returns true.

Let’s take an example to demonstrate ng-readonly directive.

See this example:

Test it Now

You may also like