我有一个名为eventPlans
的对象列表,在带有一些过滤器的div中显示。现在我想将名为pendingEventPlans
的筛选列表传递给我的搜索指令中的另一个指令。
<div>
<search-box list-to-count="pendingEventPlans" search-text="searchText" display-text="'Total event plans'"></search-box>
<div class="has-search-with-count">
<div class="list card" ng-repeat="item in pendingEventPlans = (eventPlans | orderBy : 'from_date'| filter:pendingFilter | filter:searchText )">
<div>{{item.name}}</div>
</div>
</div>
</div>
然后在search-box
指令中,列表未定义。
实际问题出在我的ionic v1
应用代码中。我构建了一个fiddle来尝试模拟问题。
答案 0 :(得分:0)
此时pendingEventPlans
未定义,您应该执行以下操作:
<div>
<search-box list-to-count="(eventPlans | filter:pendingFilter | filter:searchText )" search-text="searchText" display-text="'Total event plans'"></search-box>
<div class="has-search-with-count">
<div class="list card" ng-repeat="item in pendingEventPlans = (eventPlans | orderBy : 'from_date'| filter:pendingFilter | filter:searchText )">
<div>{{item.name}}</div>
</div>
</div>