앵귤러js orderBy 필터로 표시 > 퍼블리싱강좌

퍼블리싱강좌

앵귤러js orderBy 필터로 표시 정보

AngularJS 앵귤러js orderBy 필터로 표시

본문

앵귤러js orderBy 필터로 표시

표를 정렬하려면 orderBy 필터를 추가하십시오 .


<table>
  <tr ng-repeat="x in names | orderBy : 'Country'">
    <td>{{ x.Name }}</td>
    <td>{{ x.Country }}</td>
  </tr>
</table>


<!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 | orderBy : 'Country'">
    <td>{{ x.Name }}</td>
    <td>{{ x.Country }}</td>
추천
0
  • 복사

댓글 0개

© SIRSOFT
현재 페이지 제일 처음으로