Mivaweb Mivaweb - 7 months ago 25
AngularJS Question

Remove elements from array above an index AngularJS

Is there a quick helper for removing elements from an array above a certain index in AngularJS?

For instance:

You have an array with 5 elements:


I want to remove all elements above index 2:




Yes, there is:

array.slice(start, end)

In your case, something like this:

array.slice(0, -2)