AngularJs ng-repeat限制循环次数

重复数组:
<ul ng-init='name=[1,2,3,3]'> <li ng-repeat="name in name track by $index"> {{name}} </li> </ul> 对象: <ul ng-init='obj={ a:"aaa", b:"bbb", c:"ccc" }'> <li ng-repeat='(key, value) in obj'>{{key}},{{value}}</li> </ul> 限制次数 | limitTo:num <ul ng-init='obj2=[{ a:"1aaa", b:"bbb"},{a:"2eee",b:"fff"},{a:"3i", b:"jjj"}]'> <li ng-repeat='obj2 in obj2 | limitTo:2'>{{obj2.a}}+{{obj2.b}}</li> </ul>

 限制次数 | limitTo:num

posted @ 2016-10-09 15:05  菜鸟一小只  阅读(15190)  评论(0编辑  收藏  举报