How to remove an item from an array in AngularJS scope?

后端 未结 10 1746
梦毁少年i
梦毁少年i 2020-11-27 09:10

Simple to-do list, but with a delete button on list page for each item:

Relevant template HTML:


          


        
10条回答
  •  野性不改
    2020-11-27 09:55

    For the the accepted answer of @Joseph Silber is not working, because indexOf returns -1. This is probably because Angular adds an hashkey, which is different for my $scope.items[0] and my item. I tried to resolve this with the angular.toJson() function, but it did not work :(

    Ah, I found out the reason... I use a chunk method to create two columns in my table by watching my $scope.items. Sorry!

提交回复
热议问题