AngularJS:来自第二个索引的 ng-repeat [英] AngularJS: ng-repeat from second index

查看:22
本文介绍了AngularJS:来自第二个索引的 ng-repeat的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想重复但只从第二个数组元素到最后一个.我尝试使用

I would like to ng-repeat but only from the second array element until the last. I tried to use

ng-repeat="entry in entries | filter: $index==0"

但是这个没有用.如果我尝试使用 ng-if,就像这样

but this one didn't work. If I attempt to use ng-if, like this

ng-repeat="entry in entries" ng-if="$index != 0"

我在嵌入时遇到错误.

对此的最佳解决方案是什么?顺便说一句,我的 AngularJS 版本是 1.1.5,因为我的应用程序是 Hawtio 的插件(仍然停留在 1.1.5 版).谢谢.

What's the best solution for this? BTW, my AngularJS version is 1.1.5 because my app is a plugin for Hawtio (which is still stuck in version 1.1.5). Thanks.

推荐答案

为什么不只是:

ng-repeat="entry in entries.slice(1,entries.length)"

小提琴:http://jsfiddle.net/10d6o1aq/

这篇关于AngularJS:来自第二个索引的 ng-repeat的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆