Cam*_*ron 7 javascript angularjs
是什么在等号ng-repeat
的属性值是什么意思?
<li ng-repeat="person in people = (people | orderBy: firstname)">
Run Code Online (Sandbox Code Playgroud)
而不是做:
<li ng-repeat="person in people | orderBy: firstname">
Run Code Online (Sandbox Code Playgroud)
我看不到任何解释它在ngRepeat文档中使用的例子.
计算有多少对象被过滤是有用的,例如.
function People($scope) {
$scope.people = [{
firstname: 'a'
}, {
firstname: 'c'
}, {
firstname: 'b'
}, {
firstname: 'c'
}]
}
Run Code Online (Sandbox Code Playgroud)
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.23/angular.min.js"></script>
<div ng-app ng-controller="People">
<ul>
<li ng-repeat="person in filteredPeople = (people | filter: 'c')">{{person.firstname}}</li>
</ul>
Total filtered: {{ filteredPeople.length }}
</div>
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
210 次 |
最近记录: |