AngularJS CSS 스타일로 표시하기

· 8년 전 · 1424
AngularJS CSS 스타일로 표시하기

ng-repeat 지시어는 테이블을 표시하는 데 적합합니다.

테이블에 데이터 표시
각도가있는 표를 표시하는 것은 매우 간단합니다.

CSS 스타일
<style>
table, th , td {
border: 1px solid grey;
border-collapse: collapse;
padding: 5px;
}
table tr:nth-child(odd) {
background-color: #f1f1f1;
}
table tr:nth-child(even) {
background-color: #ffffff;
}
</style>

[전체소스]
<!DOCTYPE html>
<html>
<style>
table, th , td {
border: 1px solid grey;
border-collapse: collapse;
padding: 5px;
}
table tr:nth-child(odd) {
background-color: #f1f1f1;
}
table tr:nth-child(even) {
background-color: #ffffff;
}
</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>{{ x.Name }}</td>
<td>{{ 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>
|
댓글을 작성하시려면 로그인이 필요합니다.

퍼블리싱강좌

+
분류 제목 글쓴이 날짜 조회
AngularJS 8년 전 조회 1,552
AngularJS 8년 전 조회 1,341
AngularJS 8년 전 조회 1,395
AngularJS 8년 전 조회 1,505
AngularJS 8년 전 조회 1,261
AngularJS 8년 전 조회 1,999
AngularJS 8년 전 조회 1,571
AngularJS 8년 전 조회 1,223
AngularJS 8년 전 조회 1,534
AngularJS 8년 전 조회 1,309
AngularJS 8년 전 조회 1,121
AngularJS 8년 전 조회 2,092
AngularJS 8년 전 조회 1,169
AngularJS 8년 전 조회 1,231
AngularJS 8년 전 조회 1,425
AngularJS 8년 전 조회 1,275
AngularJS 8년 전 조회 1,466
AngularJS 8년 전 조회 1,482
AngularJS 8년 전 조회 1,251
AngularJS 8년 전 조회 1,218
AngularJS 8년 전 조회 1,619
AngularJS 8년 전 조회 1,604
AngularJS 8년 전 조회 1,446
AngularJS 8년 전 조회 1,320
AngularJS 8년 전 조회 1,758
AngularJS 8년 전 조회 1,208
AngularJS 8년 전 조회 1,611
AngularJS 8년 전 조회 1,539
AngularJS 8년 전 조회 1,238
AngularJS 8년 전 조회 1,779