ng-repeat高級用法:
遍歷數組:
<li ng-repeat="item in array">{{item}}</li>
遍歷對象:
key:對象的key
value:對象的value
<li ng-repeat="(key,value) in obj">{{key}} | {{value}}</li>
綁定$$haskKey:
給每一個item綁定惟一ID,當數組發生變化時,ID不變!
<li ng-repeat="item in items track by $id(item)"></li>
過濾器:
對item的每一個屬性進行模糊匹配
<li ng-repeat="item in items |filter: 25"></li>
綁定屬性過濾:
對item的某個屬性進行模糊匹配
<li ng-repeat="item in items |filter: 25 track by item.age"></li>
保存匹配結果:
把匹配到的結果另存到results數組變量,可供外部使用
<li ng-repeat="item in items |filter: 25 as results"></li>
保存針對某個屬性的過濾結果:
<li ng-repeat="item in items |filter: 25 as results track by item.age "></li>