角1.5预计数组,但好评:0使用过滤器

角1.5预计数组,但好评:0使用过滤器

问题描述:

当我创建一个表,当我显示数据正常工作,这是代码角1.5预计数组,但好评:0使用过滤器

<tr ng-repeat="value in sd.data track by $index | orderBy: syscode"> 
    <td>{{($index>0 && sd.data[$index].syscode === sd.data[$index-1].syscode) ? '' : value.syscode}}</td> 
    <td>{{value.out_signal_id}}</td> 
    <td class="text-center no-wrapping">{{value.sig_epoch_utc}}</td> 
    <td class="text-center ">{{value.num_of_signals}}</td> 
    <td class="text-center no-wrapping">{{value.status_code}}</td> 
    <td class="text-center no-wrapping">{{value.status_note}}</td> 


<tr > 

我的问题是,当我使用“排序依据: “作为过滤器,我得到这个错误

`Error: [orderBy:notarray] Expected array` but received: 0 

我不知道为什么,我已检查与此类似的其他问题,但这些并没有回答我的问题。任何反馈将不胜感激谢谢

轨道应为始终末和你错过顶点这样的:

<tr ng-repeat="value in sd.data track by $index | orderBy: syscode"> 

应该是:

<tr ng-repeat="value in sd.data | orderBy: 'syscode' track by $index"> 
+0

我想这个答案,我仍然得到了同样的错误 – hjm

+0

对不起更新,我没有看到赛道由 – quirimmo

+0

这个工作的感谢! – hjm

这个确切的情况是覆盖在the docs for ngRepeat (see the note at the bottom of the section)。基本上,track by需要是你表达中最后一件事。

value in sd.data | orderBy: 'syscode' track by $index