My custom component click
function is triggered twice - both custom component's event and sample level event are triggered.
Here's my Plunker:
My custom component click
function is triggered twice - both custom component's event and sample level event are triggered.
Here's my Plunker:
Your problem is that you call click() event on your parent component and in your child component: here:
and here:
remove the click event on your
<cus-div></cus-div>
of your click event and it will trigger onceBecause you have bound it twice on the child component and on the parent component. The
mouseEvent
propagates from the child component to the parent component by default. You can stop propagation of event to parent component.Template:
Class: