在离子滑动盒内过滤ng-repeat会破坏一切

时间:2016-03-23 16:23:57

标签: angularjs filter ionic-framework

我使用离子幻灯片将项目列表显示为幻灯片页面,现在我想添加过滤该列表的功能。

问题是:当我应用过滤器时,幻灯片似乎破了:(

这是我如何进行此过滤的示例:

<input type="text" ng-model="myFilter" style="border: 1px solid black;">
  <ion-slide-box>
    <ion-slide ng-repeat="item in items | filter:myFilter">
      <div class="card" style="height: 200px;">
        <h1 style="text-align: center;">{{ item }}</h1>
      </div>
    </ion-slide>
  </ion-slide-box>

这里有一个Codepen作为示例。

http://codepen.io/gbrennon/full/grWxvg/

1 个答案:

答案 0 :(得分:2)

看起来您需要让幻灯片知道范围变量已更新,如建议here

如果仍有问题,请尝试手动过滤数组,而不是使用Angular过滤器,并在更新阵列后调用$ionicSlideBoxDelegate.update();