当前位置:AngularJS API / ng / 指令(directive) / ngReadonly
ngReadonly
设置输入框为只读:
Readonly: <input type="checkbox" ng-model="all"> <br> <input type="text" ng-readonly="all">尝试一下 »
ng-readonly 指令用于设置表单域(input 或 textarea) 的 readonly 属性。
如果 ng-readonly 属性的表达式返回 true 则表单域为只读。
<input ng-readonly="expression"></input>
<input> <textarea> 元素支持该指令。
值 | 描述 |
---|---|
expression | 表达式返回 true 则表单域为只读。 |