AngularJSng-readonly
ディレクティブ
例
入力フィールドを読み取り専用にします。
Readonly: <input type="checkbox" ng-model="all">
<br>
<input type="text" ng-readonly="all">
定義と使用法
ng-readonly
ディレクティブは、フォームフィールド(inputまたはtextarea)の読み取り専用属性を設定します。
ng-readonly
属性内の式がtrueを返す場合、フォームフィールドは読み取り専用になります。
ディレクティブは、との間でng-readonly
値をシフトできるようにするために必要です。HTMLでは、属性をに設定することはできません(readonly属性が存在すると、値に関係なく、要素は読み取り専用になります)。true
false
readonly
false
構文
<input ng-readonly="expression"></input>
<input> <textarea>要素でサポートされています。
パラメータ値
Value | Description |
---|---|
expression | An expression that will set the element's readonly attribute if it returns true. |