<!DOCTYPE HTML><HTMLNg-app= "MyApp"> <Head> <MetaCharSet= "Utf-8" /> <title></title> <Scripttype= "Text/javascript"src= "Js/angular.min.js" ></Script> <Script> varapp=Angular.module ('MyApp', []); App.factory ('averages', function(){ varAVGs= {}; Avgs.count=[{name:'Zhangsan', Age: *}, {name:'Lisi', Age: -}, {name:'Wangwu', Age: - } ]; returnAVGs; }); functionAvgctrl ($scope, averages) {$scope. AVGs=averages; } </Script> </Head> <Body> <DivNg-controller= "Avgctrl"> <inputtype= "text"Ng-model= "Search.name" /> <ul> <Ling-repeat= "Count in Avgs.count | filter:search >
Ng-repeat can be understood as Forin, of course ng-repeat more powerful than the forin we understand.
Ng-repeat can be combined with filters for more functionality
Filter List: Filter:search find data that matches search (if string ignores case)
Sort by: ' Age ' in ascending order of Ages, by order: '-age ' in descending order of age
List interception: Limitto:2 display 2 data in positive order limitto:-2 2 data in reverse
Other filters:
Timestamp Format: date Example {{timestamp (timestamp) | date: ' YYYY-MM-DD HH:mm:ss '}}
Casing: Lowercase, uppercase example: {' abc ' | uppercase}}