I have a click event nested one level. When i click on the child the expected function is called but the parent's function is also called. Here is the code
<li class="task-item" *ngFor="let task of tasks" (click)="showTask(task.name)">
<input type="checkbox" [ngModel]="task.taskStatus" (ngModelChange)="changeTaskStatus($event)" />
</li>
So when the checkbox changes changeTaskStatus()
and the showTask()
called together. I want the parent to keep quiet when checkbox changes. How do I achieve this? It was easy to handle this in Angular 1
Things I've tried that failed
Used $event.stopPropagation()
in the checkbox's click event that changed nothing
<input type="checkbox" [ngModel]="task.taskStatus" (click)="$event.stopPropagation()" (ngModelChange)="changeTaskStatus($event)" />