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>
게시판 목록
퍼블리싱강좌
| 번호 | 분류 | 제목 | 글쓴이 | 날짜 | 조회 |
|---|---|---|---|---|---|
| 28 | 반응형웹 | 9년 전 | 4495 | ||
| 27 | 반응형웹 | 9년 전 | 7564 | ||
| 26 | 부트스트랩 |
|
10년 전 | 14833 | |
| 25 | 부트스트랩 |
|
10년 전 | 9426 | |
| 24 | 표준화 | 11년 전 | 8297 | ||
| 23 | 반응형웹 | 12년 전 | 13496 | ||
| 22 | 표준화 | 12년 전 | 9470 | ||
| 21 | 표준화 | 12년 전 | 16759 | ||
| 20 | 반응형웹 | 13년 전 | 19693 | ||
| 19 | 반응형웹 | 13년 전 | 31018 | ||
| 18 | 반응형웹 | 13년 전 | 36494 | ||
| 17 | 표준화 | 13년 전 | 12912 | ||
| 16 | 반응형웹 | 13년 전 | 29311 | ||
| 15 | 반응형웹 | 13년 전 | 11844 | ||
| 14 | 반응형웹 | 13년 전 | 31758 | ||
| 13 | 반응형웹 | 13년 전 | 29739 | ||
| 12 | 반응형웹 | 13년 전 | 39249 | ||
| 11 | 반응형웹 | 13년 전 | 50646 | ||
| 10 | 반응형웹 | 13년 전 | 32791 | ||
| 9 | 표준화 | 13년 전 | 9160 | ||
| 8 | 표준화 | 13년 전 | 11238 | ||
| 7 | 표준화 | 13년 전 | 9175 | ||
| 6 | 표준화 | 13년 전 | 11145 | ||
| 5 | 표준화 | 13년 전 | 11245 | ||
| 4 | 표준화 | 13년 전 | 14724 | ||
| 3 | 표준화 | 13년 전 | 8074 | ||
| 2 | 표준화 | 13년 전 | 10176 | ||
| 1 | 표준화 | 13년 전 | 11910 |
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기