簡體   English   中英

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>

過濾器即使應該也不會返回任何數據,但是在控制台中沒有返回錯誤。

有人可以幫我弄清楚語法嗎?

您應該通過指定要匹配的對象來將過濾器放在特定屬性上,例如filter: {'tournament': {season : {seasonName:'2022'}}}

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

filter接受字符串,對象或函數,而不是數組filter api

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM