Click on child element triggers its own ng-click and parent's too #5237
Comments
It seems that the |
@tbosch please make decision whether this works as expected or if there is something we can do to deal with this situation. we can't stop the propagation by default because there would be no way to unstop it. |
There are valid use cases for not stopping the propagation. E.g. usecase: Right now this is possible, see this punk: http://plnkr.co/edit/jVIovi0L9Hgo1Bl9t72O?p=preview Closing this as it works as expected. |
Just you need to add $event.stopPropagation() code on Child div on click event <input (click)="onChildClickFunction();$event.stopPropagation()"/> |
@gomteshhatgine on mobile or ionic it didn't work. it make child ng-click not triggered too. |
@gomteshhatgine in my case, it still trigger as parent perform. Do you have another approach? |
@maceonrails Dont know about mobile I didn't tried @xenogew it should work |
@gomteshhatgine thanks. it's worked. |
Doesn't work anymore |
If I have a
<div>
with anng-click
and then a<button>
inside with a separateng-click
, clicking the button will fire bothng-click
handlers.I found Igor's ancient PR for this (#31 !) but it seems that the
stopPropagation()
he added has been lost somewhere in between.I tried to bisect, but found that it isn't working in 1.2.3, master, 1.1.5, 1.1.3, 1.0.6, or 1.0.3. I tried to bisect between master and Igor's commit in the above PR, but they changes got so old (0.10.x) that my test app won't work at all.
Simple test case to reproduce this on Plunkr.
The text was updated successfully, but these errors were encountered: