AngularJS 过滤深层属性
AngularJS filter on deep properties
我正在尝试根据字符串值过滤一些数据,但语法不正确。这是我的代码:
<tbody ng-repeat="qbRating in vm.scope.qbRatings | filter:'tournament.season.seasonName':'2022' | ratingFilter | orderBy:'-rating'">
<tr class="qbrating2022">
<td>{{ qbRating.tournament.season.seasonName }}</td>
<td>{{ qbRating.team.teamName }}</td>
<td>{{ qbRating.completion }}</td>
<td>{{ qbRating.gain }}</td>
<td>{{ qbRating.touchdown }}</td>
<td>{{ qbRating.interception }}</td>
<td>{{ qbRating.rating }}</td>
</tr>
</tbody>
过滤器没有 return 任何数据,尽管它应该有,但控制台中没有 return 错误。
谁能帮我把语法写对?
过滤器采用字符串、对象或函数,而不是数组filter api
您应该通过指定要匹配的对象来对特定 属性 进行过滤,例如 filter: {'tournament': {season : {seasonName:'2022'}}}
ng-repeat="qbRating in vm.scope.qbRatings | filter: {'tournament': {season : {seasonName:'2022'}}} | ratingFilter | orderBy:'-rating'"
我正在尝试根据字符串值过滤一些数据,但语法不正确。这是我的代码:
<tbody ng-repeat="qbRating in vm.scope.qbRatings | filter:'tournament.season.seasonName':'2022' | ratingFilter | orderBy:'-rating'">
<tr class="qbrating2022">
<td>{{ qbRating.tournament.season.seasonName }}</td>
<td>{{ qbRating.team.teamName }}</td>
<td>{{ qbRating.completion }}</td>
<td>{{ qbRating.gain }}</td>
<td>{{ qbRating.touchdown }}</td>
<td>{{ qbRating.interception }}</td>
<td>{{ qbRating.rating }}</td>
</tr>
</tbody>
过滤器没有 return 任何数据,尽管它应该有,但控制台中没有 return 错误。
谁能帮我把语法写对?
过滤器采用字符串、对象或函数,而不是数组filter api
您应该通过指定要匹配的对象来对特定 属性 进行过滤,例如 filter: {'tournament': {season : {seasonName:'2022'}}}
ng-repeat="qbRating in vm.scope.qbRatings | filter: {'tournament': {season : {seasonName:'2022'}}} | ratingFilter | orderBy:'-rating'"