gpt4 book ai didi

jquery - 过滤数据AngularJS后显示消息空结果

转载 作者:行者123 更新时间:2023-12-01 06:44:54 27 4
gpt4 key购买 nike

我正在使用 angularjs 创建一个应用程序。我已经集成了多个过滤器并根据过滤器搜索结果。但是当过滤器没有返回结果时,我无法显示消息没有结果。这是我的代码:

 <div dir-paginate="partners in partnersData|orderBy:orderByField:reverseSort|filter:partners.name|filter:partners.website|filter:partners.location|itemsPerPage: pageSize" current-page="currentPage">
<div class="rowDiv">
<div class="cellDiv"><span ng-click="makeFavourite(partners)" class="star_rating" ng-class="{'select':partners.select}"></span> <span ng-click="showImage($index)"></span></div>
<div class="cellDiv" ng-click="showName($index)">{{partners.name}}</div>
<div class="cellDiv">{{partners.website}}</div>
<div class="cellDiv">{{partners.location}}</div>
<div class="cellDiv">{{partners.service}}</div>
<div class="cellDiv">{{partners.connection}}</div>
<div class="cellDiv">{{partners.action}}</div>
<div class="cellDiv lastCell"><span class="icon_pluse" ng-click="openPlus($index)"></span><span class="icon_info" ng-click="openInfo($index)"></span></div>
<div ng-if="partnersData.length === 0">No Items Found</div>
</div>

最佳答案

从 Angular 1.4 开始,您可以使用 as aliasName 为过滤数组创建别名,该别名将添加到当前范围。重要的是 as 位于表达式中的所有过滤器之后

<div dir-paginate="partners in partnersData|orderBy:...|...| lastFilter as filteredArray">

</div>

<!-- Outside paginate directive -->
<div ng-if="!filteredArray.length">No results</div>

关于jquery - 过滤数据AngularJS后显示消息空结果,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34869249/

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