ng-repeat와 ng-options
객체 배열이 있다고 가정합니다.
$scope.cars = [
{model : "Ford Mustang", color : "red"},
{model : "Fiat 500", color : "white"},
{model : "Volvo XC90", color : "black"}
];
ng-repeat지시어는, 선택된 값은 문자열이어야합니다 한계가있다 :
예
사용 ng-repeat:
<select ng-model="selectedCar">
<option ng-repeat="x in cars" value="{{x.model}}">{{x.model}}</option>
</select>
<h1>You selected: {{selectedCar}}</h1>
ng-options지시문을 사용할 때 선택한 값은 객체가 될 수 있습니다.
예
사용 ng-options:
<select ng-model="selectedCar" ng-options="x.model for x in cars">
</select>
<h1>You selected: {{selectedCar.model}}</h1>
<p>Its color is: {{selectedCar.color}}</p>
선택한 값이 객체 일 수 있으면 더 많은 정보를 보유 할 수 있으므로 응용 프로그램의 유연성이 향상됩니다.
ng-options이 튜토리얼 에서는 지침을 사용합니다 .
$scope.cars = [
{model : "Ford Mustang", color : "red"},
{model : "Fiat 500", color : "white"},
{model : "Volvo XC90", color : "black"}
];
ng-repeat지시어는, 선택된 값은 문자열이어야합니다 한계가있다 :
예
사용 ng-repeat:
<select ng-model="selectedCar">
<option ng-repeat="x in cars" value="{{x.model}}">{{x.model}}</option>
</select>
<h1>You selected: {{selectedCar}}</h1>
ng-options지시문을 사용할 때 선택한 값은 객체가 될 수 있습니다.
예
사용 ng-options:
<select ng-model="selectedCar" ng-options="x.model for x in cars">
</select>
<h1>You selected: {{selectedCar.model}}</h1>
<p>Its color is: {{selectedCar.color}}</p>
선택한 값이 객체 일 수 있으면 더 많은 정보를 보유 할 수 있으므로 응용 프로그램의 유연성이 향상됩니다.
ng-options이 튜토리얼 에서는 지침을 사용합니다 .
게시판 목록
퍼블리싱강좌
| 번호 | 분류 | 제목 | 글쓴이 | 날짜 | 조회 |
|---|---|---|---|---|---|
| 118 | jQuery Mobile | 8년 전 | 1335 | ||
| 117 | jQuery Mobile | 8년 전 | 1589 | ||
| 116 | jQuery Mobile | 8년 전 | 1815 | ||
| 115 | jQuery Mobile | 8년 전 | 1772 | ||
| 114 | jQuery Mobile | 8년 전 | 1959 | ||
| 113 | jQuery Mobile | 8년 전 | 1872 | ||
| 112 | jQuery Mobile | 8년 전 | 2482 | ||
| 111 | jQuery Mobile | 8년 전 | 1784 | ||
| 110 | jQuery Mobile | 8년 전 | 1576 | ||
| 109 | jQuery Mobile | 8년 전 | 1735 | ||
| 108 | jQuery Mobile | 8년 전 | 1962 | ||
| 107 | jQuery Mobile | 8년 전 | 1766 | ||
| 106 | jQuery Mobile | 8년 전 | 1445 | ||
| 105 | jQuery Mobile | 8년 전 | 1738 | ||
| 104 | jQuery Mobile | 8년 전 | 2405 | ||
| 103 | jQuery Mobile | 8년 전 | 1556 | ||
| 102 | jQuery Mobile | 8년 전 | 1497 | ||
| 101 | jQuery Mobile | 8년 전 | 1679 | ||
| 100 | jQuery Mobile | 8년 전 | 1914 | ||
| 99 | jQuery Mobile | 8년 전 | 1370 | ||
| 98 | jQuery Mobile | 8년 전 | 1391 | ||
| 97 | jQuery Mobile | 8년 전 | 1651 | ||
| 96 | jQuery Mobile | 8년 전 | 1306 | ||
| 95 | jQuery Mobile | 8년 전 | 1124 | ||
| 94 | jQuery Mobile | 8년 전 | 1521 | ||
| 93 | jQuery Mobile | 8년 전 | 1144 | ||
| 92 | jQuery Mobile | 8년 전 | 1563 | ||
| 91 | jQuery Mobile | 8년 전 | 1510 | ||
| 90 | jQuery Mobile | 8년 전 | 1677 | ||
| 89 | jQuery Mobile | 8년 전 | 1661 |
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기