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년 전 | 2735 | ||
| 207 | AngularJS | 8년 전 | 1479 | ||
| 206 | AngularJS | 8년 전 | 1128 | ||
| 205 | AngularJS | 8년 전 | 994 | ||
| 204 | AngularJS | 8년 전 | 1399 | ||
| 203 | AngularJS | 8년 전 | 1198 | ||
| 202 | AngularJS | 8년 전 | 1510 | ||
| 201 | AngularJS | 8년 전 | 1460 | ||
| 200 | AngularJS | 8년 전 | 1433 | ||
| 199 | AngularJS | 8년 전 | 1357 | ||
| 198 | AngularJS | 8년 전 | 1239 | ||
| 197 | AngularJS | 8년 전 | 1401 | ||
| 196 | AngularJS | 8년 전 | 1059 | ||
| 195 | AngularJS | 8년 전 | 1264 | ||
| 194 | AngularJS | 8년 전 | 1275 | ||
| 193 | AngularJS | 8년 전 | 1622 | ||
| 192 | AngularJS | 8년 전 | 1367 | ||
| 191 | AngularJS | 8년 전 | 1594 | ||
| 190 | AngularJS | 8년 전 | 1565 | ||
| 189 | AngularJS | 8년 전 | 1654 | ||
| 188 | AngularJS | 8년 전 | 1414 | ||
| 187 | AngularJS | 8년 전 | 1375 | ||
| 186 | AngularJS | 8년 전 | 1422 | ||
| 185 | AngularJS | 8년 전 | 1452 | ||
| 184 | AngularJS | 8년 전 | 1493 | ||
| 183 | AngularJS | 8년 전 | 1488 | ||
| 182 | AngularJS | 8년 전 | 1015 | ||
| 181 | AngularJS | 8년 전 | 1396 | ||
| 180 | AngularJS | 8년 전 | 1288 | ||
| 179 | AngularJS | 8년 전 | 1264 |
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기