I'm using ng-repeat and trying to use the $index in a filter like this
<div data-ng-repeat="i in [1,2,3,4,5,6,7,8,9]">
<div ng-repeat="student in students | filter:{Surname:'Smith', Group: {{$index}}">
<span ng-click="updateStudent(student.StudentID)">{{student.FullName}}</span>
</div>
</div>
I'm getting a syntax error in the Chrome dev tools console. Is it possible to use $index like this?
I have also tried Group: $index without the braces
你不需要双括号,因为你正在使用ng-repeat
,但你也错过了最后的}
ng-repeat="student in students | filter:{Surname:'Smith', Group: $index}"
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.