앵 귤 러 필터
11068 단어 angularjs 입문 학습
:<span ng-bind="price">
1:<span ng-bind="price | currency">span>
:<input type="text" ng-model="length"><br />
:<input type="text" ng-model="index">
<br />
<ul>
<li ng-repeat="u in users | limitTo:length:index">
<span ng-bind="u.userID">span>****
<span ng-bind="u.username">span>****
<span ng-bind="u.nickname">span>
li>
ul>
2:<span ng-bind="price | currency:' ¥'">span> 3:<span ng-bind="price | currency:'¥':3">span>
$scope.price=12
2 일자 시간 필터 date 원본 출력: "2017 - 04 - 29T 13: 08: 23.027Z" 날짜 포맷: Apr 29, 2017 날짜 포맷: 통상 적 인 경우 사용자 의 요구 에 따라 출력 해 야 하 며, 이때 매개 변수 y / M / d / h / m / s / E 년 / 월 / 일 / 시 / 분 / 초 / 주 2017 년 04 월 29 일 09: 08: 23 2017 년 04 월 29 일 09: 08: 23
<span ng-bind="date | date:'yyyy MM dd hh:mm:ss'">span>
<span ng-bind="date | date:'yyyy MM dd '">span>
<span ng-bind="date | date:'hh:mm:ss'">span>
3. 출력 키워드 필터 링:
1 - cat - tom - (걸 러 낸)
:<input type="text" ng-model="keyword">
<ul>
<li ng-repeat="u in users | filter:keyword">
<span ng-bind="u.userID">span>---
<span ng-bind="u.username">span>---
<span ng-bind="u.nickname">span>
li>
ul>
4. JSON 필터 (데이터 의 대상 을 JSON 문자열 로 변환 하 는 형식 출력 을 페이지 에 자주 코드 프로그램 디 버 깅 에 사용) 배열 의 json 대상 을 문자열 로 출력 할 수 있 습 니 다.
<span ng-bind="users|json">span>
5. 길이 제한 필터 길이: 길이 자 르 기 위치: 어느 위치 부터 1 - cat - tom 2 - mouse - jerry (걸 러 낸)
:<input type="text" ng-model="length">
:<input type="text" ng-model="index">
<ul>
<li ng-repeat="u in users | limitTo:length:index">
<span ng-bind="u.userID">span>---
<span ng-bind="u.username">span>---
<span ng-bind="u.nickname">span>
li>
ul>
6. 문자열 대소 문자 변환 필터 John Smith JOHN SMITH john smith
<div ng-bind="name">div>
<div ng-bind="name | uppercase">div>
<div ng-bind="name | lowercase">div>
7. 정렬 출력 정렬 키워드: 정렬 순서: 거꾸로 2 - mouse - jerry (필터 링 된)
:<input type="text" ng-model="keyword">
:<input type="checkbox" ng-model="sort">
<ul>
<li ng-repeat="u in users | orderBy:keyword:sort">
<span ng-bind="u.userID">span>---
<span ng-bind="u.username">span>---
<span ng-bind="u.nickname">span>
li>
ul>