0

I wrote the next code, but when I click on the trash icon, the ng-click of this element is thrown, but the ng-click of the div container is thrown too, I don't need the second one, just the first call, could some body help me.

  <div ng-if="order.selectedProducts === null || order.selectedProducts.length > 0"
    class="cartCol hoverable" ng-repeat="product in order.selectedProducts track by $index"
    ng-click="showProductDetailed(product)">
    <div class="cartHeading" ng-bind="product.name"></div>
    <a href="" class="trashIcon" ng-click="removeSelectedProduct(product);">
      <i class="fa fa-trash"></i>
    </a>
    <div class="cartSizeInfo">
      <span class="fltLft">{{product.productTypeName}}</span>
      <span class="fltRht">Bs. {{product.price}}</span>
    </div>
  </div>

3
  • check this stackoverflow.com/questions/32330112/… Commented Nov 1, 2017 at 19:50
  • 2
    solved, I had to put $event.stopPropagation(); after the first call. Commented Nov 1, 2017 at 20:00
  • @MiltonCh Why don't you put it as an answer. It will help future readers. Commented Nov 1, 2017 at 20:13

1 Answer 1

1

I had to put $event.stopPropagation(); after the first call.

Sign up to request clarification or add additional context in comments.

1 Comment

sometimes it may create another issue - say tooltip is not closed after clicking trash icon since listener is attached to <body>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.