``` --- ">
``` --- " />
Easy Tutorial
❮ Ng Ng Bind Ng Ng Switch ❯

AngularJS ng-readonly Directive

AngularJS Reference Manual


AngularJS Example

Set the input field to read-only:

Readonly: <input type="checkbox" ng-model="all"><br>
<input type="text" ng-readonly="all">

Definition and Usage

The ng-readonly directive is used to set the readonly attribute of a form field (input or textarea).

If the expression of the ng-readonly attribute returns true, the form field is set to read-only.


Syntax

The directive is supported by <input> and <textarea> elements.


Parameter Values

Value Description
expression If the expression returns true, the form field is set to read-only.

AngularJS Reference Manual

❮ Ng Ng Bind Ng Ng Switch ❯