AngularJS ng-readonly지시문


예시

입력 필드를 읽기 전용으로 만듭니다.

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

정의 및 사용

지시문 은 ng-readonly양식 필드(입력 또는 텍스트 영역)의 읽기 전용 속성을 설정합니다.

ng-readonly 속성 내부의 표현식이 true를 반환하는 경우 양식 필드는 읽기 전용이 됩니다 .

ng-readonly사이에서 값을 이동할 수 있으려면 지시문이 필요 합니다 . HTML에서는 속성을 로 설정할 수 없습니다 (readonly 속성의 존재는 값에 관계없이 요소를 읽기 전용으로 만듭니다).truefalsereadonlyfalse


통사론

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

<input> <textarea> 요소에서 지원됩니다.


매개변수 값

Value Description
expression An expression that will set the element's readonly attribute if it returns true.