为什么angularjs过滤器不适用于轨道?

时间:2015-02-05 14:36:36

标签: javascript angularjs

我们不能在angularjs中使用带轨道的过滤器吗?如果我们能够解决这个问题背后的问题。请在这里找到小提琴http://jsfiddle.net/Tc34P/34/

<div ng-controller="Ctrl">
<p ng-init='dd=[{"a":["abcd"]},{"n":["efrg","efgh"]},{"z":["zela"]},{"p":["mithun","mithun","mithun"]}]'></p>
<input type="text" ng-model="x">
 <div ng-repeat="cc in dd">
<div ng-repeat="(v,s) in cc ">
    {{v}}
  <div ng-repeat ="c in s track by $index | filter:x">
     {{c}}
    </div>
 <div>
    </div>

1 个答案:

答案 0 :(得分:4)

您只需要将track by表达式放在最后:

ng-repeat="c in s | filter:x track by $index"