AngularJS ng-selected
지시문
예시
selected
속성을 true 로 설정 합니다 .
Click here to select BMW as your favorite car:
<input type="checkbox" ng-model="mySel">
<p>My Favourite car:</p>
<select>
<option>Volvo</option>
<option ng-selected="mySel">BMW</option>
<option>Ford</option>
</select>
정의 및 사용
지시문 은 ng-selected
<select> 목록에서 <option> 요소의 selected 속성을 설정합니다.
ng-selected
속성 내부의 표현식이 true를 반환하면 옵션이 선택됩니다 .
와 ng-selected
사이에서 값을 이동할 수 있으려면 지시문이 필요 합니다 . HTML에서는 속성을 로 설정할 수 없습니다 (선택된 속성이 있으면 값에 관계없이 요소가 선택됨).true
false
selected
false
통사론
<option ng-selected="expression"></option>
<option> 요소에서 지원됩니다.
매개변수 값
Value | Description |
---|---|
expression | An expression that will set the element's selected attribute if it returns true. |