AngularJS - multiple ng-click - event bubbling

后端 未结 2 1623
陌清茗
陌清茗 2021-02-05 00:40

In the following example:

  
  • {{item.title}}

  • 2条回答
    •  别那么骄傲
      2021-02-05 01:19

      showItem can be updated to return early if the passed in item no longer exists:

      function remove(item) {
        if (-1 == $scope.items.indexOf(item)) {
          // Item no longer exists, return early
          return;
        }
        // Rest of code here
      }
      

    提交回复
    热议问题