AngularJS CSS 스타일로 표시하기

· 8년 전 · 1310
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,457
AngularJS 8년 전 조회 1,230
AngularJS 8년 전 조회 1,290
AngularJS 8년 전 조회 1,391
AngularJS 8년 전 조회 1,157
AngularJS 8년 전 조회 1,900
AngularJS 8년 전 조회 1,454
AngularJS 8년 전 조회 1,138
AngularJS 8년 전 조회 1,406
AngularJS 8년 전 조회 1,201
AngularJS 8년 전 조회 1,018
AngularJS 8년 전 조회 1,984
AngularJS 8년 전 조회 1,057
AngularJS 8년 전 조회 1,117
AngularJS 8년 전 조회 1,311
AngularJS 8년 전 조회 1,151
AngularJS 8년 전 조회 1,369
AngularJS 8년 전 조회 1,375
AngularJS 8년 전 조회 1,136
AngularJS 8년 전 조회 1,098
AngularJS 8년 전 조회 1,514
AngularJS 8년 전 조회 1,488
AngularJS 8년 전 조회 1,328
AngularJS 8년 전 조회 1,219
AngularJS 8년 전 조회 1,630
AngularJS 8년 전 조회 1,092
AngularJS 8년 전 조회 1,504
AngularJS 8년 전 조회 1,435
AngularJS 8년 전 조회 1,126
AngularJS 8년 전 조회 1,657
🐛 버그신고