search

Home  >  Q&A  >  body text

angular.js - How does ng-click block child elements?

There is the following DOM in angularjs

<p class="parent" ng-click="fun()">
    <p class="child"> </p>
</p>

I want ng-click to only fire when p.parent is clicked, and not when p.child is clicked.
I can also write complex methods, which can be achieved by judging the clicked element.
I hope it can be implemented in a simple way, preferably the function of angularjs itself. Please enlighten me.

PHP中文网PHP中文网2792 days ago816

reply all(1)I'll reply

  • 我想大声告诉你

    我想大声告诉你2017-05-15 17:02:52

    $event.stopPropagation()

    reply
    0
  • Cancelreply