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"
but this one didn't work. If I attempt to use ng-if
, like this
ng-repeat="entry in entries" ng-if="$index != 0"
I am getting error in transclusion.
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.
hide first element using
$first
You can try this:
Here's the reference.
There's a simpler solution in more recent versions of Angular (which won't work for the original question, given their restriction on Angular version 1.1.5, but it will work for others coming across this post)
The filter "limitTo" now supports a "begin" argument (docs):
So you can use it like this in a ng-repeat:
This means that ng-repeat will begin at index 1 (instead of the default index 0) and will continue for the rest of the entries array's length (which is less than entries.length, but limitTo will handle that just fine).
Why not just:
Fiddle: http://jsfiddle.net/10d6o1aq/