Mivaweb Mivaweb - 2 months ago 4x
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)