AngularJS $even과 $odd 사용하기
AngularJS $even과 $odd 사용하기
예
<table>
<tr ng-repeat="x in names">
<td ng-if="$odd" style="background-color:#f1f1f1">{{ x.Name }}</td>
<td ng-if="$even">{{ x.Name }}</td>
<td ng-if="$odd" style="background-color:#f1f1f1">{{ x.Country }}</td>
<td ng-if="$even">{{ x.Country }}</td>
</tr>
</table>
<!DOCTYPE html>
<html>
<style>
table, td {
border: 1px solid grey;
border-collapse: collapse;
padding: 5px;
}
</style>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.4/angular.min.js"></script>
<body>
<div ng-app="myApp" ng-controller="customersCtrl">
<table>
<tr ng-repeat="x in names">
<td ng-if="$odd" style="background-color:#f1f1f1">
{{ x.Name }}</td>
<td ng-if="$even">
{{ x.Name }}</td>
<td ng-if="$odd" style="background-color:#f1f1f1">
{{ x.Country }}</td>
<td ng-if="$even">
{{ x.Country }}</td>
</tr>
</table>
</div>
<script>
var app = angular.module('myApp', []);
app.controller('customersCtrl', function($scope, $http) {
$http.get("customers.php")
.then(function (response) {$scope.names = response.data.records;});
});
</script>
</body>
</html>
예
<table>
<tr ng-repeat="x in names">
<td ng-if="$odd" style="background-color:#f1f1f1">{{ x.Name }}</td>
<td ng-if="$even">{{ x.Name }}</td>
<td ng-if="$odd" style="background-color:#f1f1f1">{{ x.Country }}</td>
<td ng-if="$even">{{ x.Country }}</td>
</tr>
</table>
<!DOCTYPE html>
<html>
<style>
table, td {
border: 1px solid grey;
border-collapse: collapse;
padding: 5px;
}
</style>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.4/angular.min.js"></script>
<body>
<div ng-app="myApp" ng-controller="customersCtrl">
<table>
<tr ng-repeat="x in names">
<td ng-if="$odd" style="background-color:#f1f1f1">
{{ x.Name }}</td>
<td ng-if="$even">
{{ x.Name }}</td>
<td ng-if="$odd" style="background-color:#f1f1f1">
{{ x.Country }}</td>
<td ng-if="$even">
{{ x.Country }}</td>
</tr>
</table>
</div>
<script>
var app = angular.module('myApp', []);
app.controller('customersCtrl', function($scope, $http) {
$http.get("customers.php")
.then(function (response) {$scope.names = response.data.records;});
});
</script>
</body>
</html>
게시판 목록
퍼블리싱강좌
| 번호 | 분류 | 제목 | 글쓴이 | 날짜 | 조회 |
|---|---|---|---|---|---|
| 208 | 부트스트랩 | 8년 전 | 2730 | ||
| 207 | AngularJS | 8년 전 | 1473 | ||
| 206 | AngularJS | 8년 전 | 1119 | ||
| 205 | AngularJS | 8년 전 | 991 | ||
| 204 | AngularJS | 8년 전 | 1394 | ||
| 203 | AngularJS | 8년 전 | 1188 | ||
| 202 | AngularJS | 8년 전 | 1503 | ||
| 201 | AngularJS | 8년 전 | 1454 | ||
| 200 | AngularJS | 8년 전 | 1431 | ||
| 199 | AngularJS | 8년 전 | 1349 | ||
| 198 | AngularJS | 8년 전 | 1234 | ||
| 197 | AngularJS | 8년 전 | 1396 | ||
| 196 | AngularJS | 8년 전 | 1048 | ||
| 195 | AngularJS | 8년 전 | 1263 | ||
| 194 | AngularJS | 8년 전 | 1273 | ||
| 193 | AngularJS | 8년 전 | 1619 | ||
| 192 | AngularJS | 8년 전 | 1364 | ||
| 191 | AngularJS | 8년 전 | 1591 | ||
| 190 | AngularJS | 8년 전 | 1557 | ||
| 189 | AngularJS | 8년 전 | 1651 | ||
| 188 | AngularJS | 8년 전 | 1407 | ||
| 187 | AngularJS | 8년 전 | 1372 | ||
| 186 | AngularJS | 8년 전 | 1415 | ||
| 185 | AngularJS | 8년 전 | 1445 | ||
| 184 | AngularJS | 8년 전 | 1485 | ||
| 183 | AngularJS | 8년 전 | 1485 | ||
| 182 | AngularJS | 8년 전 | 1011 | ||
| 181 | AngularJS | 8년 전 | 1393 | ||
| 180 | AngularJS | 8년 전 | 1281 | ||
| 179 | AngularJS | 8년 전 | 1261 |
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기