AngularJS ng-readonly 指令
AngularJS 實例
設置輸入框為只讀:
Readonly: < input type= "checkbox" ng-model= "all" >
< br >
< input type= "text" ng-readonly= "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 則表單域為只讀。 |