Remove first Item of the array (like popping from stack) [duplicate]

I have list of items created via ng-repeat. I also have Delete button.
Clicking delete button removes last item of the array one by one. Plunker

But I want to remove items one by one starting from the first item. How can I do that? I used this for removing list Items:

  $scope.index = 1;
  $scope.remove = function(item) { 
    var index = $scope.cards.indexOf(item);
    $scope.cards.splice(index, 1);     
  }

Is there any way I can remove from the top?

5 Answers
5

Leave a Comment