AngularJS Filters 디렉 티브에 필터 추가
AngularJS Filters 디렉 티브에 필터 추가
[디렉 티브에 필터 추가]
필터는 ng-repeat파이프 문자 |와 필터 를 사용하여 지시문에 추가됩니다
예
orderBy필터 배열을 정렬한다 :
<div ng-app="myApp" ng-controller="namesCtrl">
<ul>
<li ng-repeat="x in names | orderBy:'country'">
{{ x.name + ', ' + x.country }}
</li>
</ul>
</div>
전체소스
<!DOCTYPE html>
<html>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.4/angular.min.js"></script>
<body>
<div ng-app="myApp" ng-controller="namesCtrl">
<p>Looping with objects:</p>
<ul>
<li ng-repeat="x in names | orderBy:'country'">
{{ x.name + ', ' + x.country }}
</li>
</ul>
</div>
<script>
angular.module('myApp', []).controller('namesCtrl', function($scope) {
$scope.names = [
{name:'Jani',country:'Norway'},
{name:'Carl',country:'Sweden'},
{name:'Margareth',country:'England'},
{name:'Hege',country:'Norway'},
{name:'Joe',country:'Denmark'},
{name:'Gustav',country:'Sweden'},
{name:'Birgit',country:'Denmark'},
{name:'Mary',country:'England'},
{name:'Kai',country:'Norway'}
];
});
</script>
</body>
</html>
[디렉 티브에 필터 추가]
필터는 ng-repeat파이프 문자 |와 필터 를 사용하여 지시문에 추가됩니다
예
orderBy필터 배열을 정렬한다 :
<div ng-app="myApp" ng-controller="namesCtrl">
<ul>
<li ng-repeat="x in names | orderBy:'country'">
{{ x.name + ', ' + x.country }}
</li>
</ul>
</div>
전체소스
<!DOCTYPE html>
<html>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.4/angular.min.js"></script>
<body>
<div ng-app="myApp" ng-controller="namesCtrl">
<p>Looping with objects:</p>
<ul>
<li ng-repeat="x in names | orderBy:'country'">
{{ x.name + ', ' + x.country }}
</li>
</ul>
</div>
<script>
angular.module('myApp', []).controller('namesCtrl', function($scope) {
$scope.names = [
{name:'Jani',country:'Norway'},
{name:'Carl',country:'Sweden'},
{name:'Margareth',country:'England'},
{name:'Hege',country:'Norway'},
{name:'Joe',country:'Denmark'},
{name:'Gustav',country:'Sweden'},
{name:'Birgit',country:'Denmark'},
{name:'Mary',country:'England'},
{name:'Kai',country:'Norway'}
];
});
</script>
</body>
</html>
첨부파일
게시판 목록
퍼블리싱강좌
| 번호 | 분류 | 제목 | 글쓴이 | 날짜 | 조회 |
|---|---|---|---|---|---|
| 88 | jQuery Mobile | 8년 전 | 1935 | ||
| 87 | jQuery Mobile | 8년 전 | 1915 | ||
| 86 | jQuery Mobile | 8년 전 | 1526 | ||
| 85 | jQuery Mobile | 8년 전 | 1835 | ||
| 84 | jQuery Mobile | 8년 전 | 1869 | ||
| 83 | jQuery Mobile | 8년 전 | 1883 | ||
| 82 | jQuery Mobile | 8년 전 | 1656 | ||
| 81 | jQuery Mobile | 8년 전 | 1371 | ||
| 80 | jQuery Mobile | 8년 전 | 1808 | ||
| 79 | jQuery Mobile | 8년 전 | 1356 | ||
| 78 | jQuery Mobile | 8년 전 | 1756 | ||
| 77 | jQuery Mobile | 8년 전 | 1782 | ||
| 76 | jQuery Mobile | 8년 전 | 1791 | ||
| 75 | jQuery Mobile | 8년 전 | 1402 | ||
| 74 | jQuery Mobile | 8년 전 | 1541 | ||
| 73 | jQuery Mobile | 8년 전 | 1248 | ||
| 72 | jQuery Mobile | 8년 전 | 1630 | ||
| 71 | jQuery Mobile | 8년 전 | 1622 | ||
| 70 | jQuery Mobile | 8년 전 | 1506 | ||
| 69 | jQuery Mobile | 8년 전 | 1514 | ||
| 68 | jQuery Mobile | 8년 전 | 2050 | ||
| 67 | jQuery Mobile | 8년 전 | 1316 | ||
| 66 | jQuery Mobile | 8년 전 | 1694 | ||
| 65 | jQuery Mobile | 8년 전 | 1186 | ||
| 64 | jQuery Mobile | 8년 전 | 1468 | ||
| 63 | jQuery Mobile | 8년 전 | 1658 | ||
| 62 | jQuery Mobile | 8년 전 | 1639 | ||
| 61 | jQuery Mobile | 8년 전 | 1876 | ||
| 60 | jQuery Mobile | 8년 전 | 1410 | ||
| 59 | jQuery Mobile | 8년 전 | 1967 |
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기