I have one box placed on top of another box both having their own separate click events. The box on top is blue and the one behind it is red. Whenever I click on the blue box the red box's click event also registers. Here's the code. Also please do not use event.preventDefault(); event.stopPropagation(); if you're answering as it has given me trouble in the past.
box1() {
console.log("box 1");
}
box2() {
console.log("box 2");
}
.box1{
left : 100px;
top: 100px;
width: 400px;
height: 400px;
background-color: red;
}
.box2{
position: relative;
left : 100px;
top: 100px;
width: 400px;
height: 400px;
background-color:blue;
}
<div class="container">
<div class="box1" (click)="box1()">
<div class="box2" (click)="box2()">
</div>
</div>
</div>