AngularJS ngRepeat element removal

后端 未结 5 1255
迷失自我
迷失自我 2021-01-30 08:19

There are quite a few questions on how to implement item removal inside ngRepeat directive, and as I figured out, it comes down to using ngClick and triggering

5条回答
  •  闹比i
    闹比i (楼主)
    2021-01-30 09:04

    You could create a generic remove method that would take in the array and the item to remove.

    {{ email }} Remove
    {{ phone }} Remove
    $scope.remove = function(array, index){ array.splice(index, 1); }

提交回复
热议问题