AngularJS ng-readonly tagubilin

Paglilinaw at paggamit

ng-readonly Ang tagubilin ay nagtatakda ng form field (input o textarea) na readonly Atributo.

Kung ng-readonly Expression sa atributo ay binabalik true, then the form field will be read-only.

ng-readonly The directive is necessary for toggling between true and false values. In HTML, you cannot set the readonly attribute to false (the presence of the readonly attribute makes the element read-only regardless of its value).

Example

Make input fields read-only:

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

Try It Yourself

Syntax

<input ng-readonly="expression</input>

Affected <input>, <textarea> Element Support.

Parameters

Parameters Description
expression If it returns true, it will set the expression of the readonly attribute of the element.