gpt4 book ai didi

javascript - AngularJS 过滤深层属性

转载 作者:行者123 更新时间:2023-11-29 19:14:09 25 4
gpt4 key购买 nike

我正在尝试根据字符串值过滤一些数据,但语法不正确。这是我的代码:

<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>

过滤器没有返回任何数据,即使它应该返回,但控制台中没有返回错误。

谁能帮我把语法写对?

最佳答案

您应该通过指定要匹配的对象来对特定属性进行筛选,例如 filter: {'tournament': {season : {seasonName:'2022'}}}

ng-repeat="qbRating in vm.scope.qbRatings | filter: {'tournament': {season : {seasonName:'2022'}}} | ratingFilter | orderBy:'-rating'"

关于javascript - AngularJS 过滤深层属性,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36669560/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com