lumosnysm
lumosnysm

Reputation: 13

Button not working inside a div which has ng-click

i have a div with ng-click inside that div is a button, when i click the button the function bind with ng-click always execute but not the button, how to just execute the ng-click of button only

<div ng-click=redirectToPage()>
    ...
    <button><button>
</div>

Upvotes: 0

Views: 54

Answers (1)

Bill P
Bill P

Reputation: 3618

You can use stopPropagation() method to prevent the event from bubbling up.

Read more: https://developer.mozilla.org/en-US/docs/Web/API/Event/stopPropagation

Check demo: DEMO

Upvotes: 3

Related Questions