AngularJS2取消父元素动作?

时间:2016-08-19 10:43:13

标签: javascript angular

<div (click)="parentAction()"> 
    <div (click)="childAction()"></div>
</div>

我想仅在此处触发childAction,但parentActionchildAction正在执行。如何在此停止parentAction

1 个答案:

答案 0 :(得分:3)

<div (click)="parentAction()"> 
    <div (click)="$event.stopPropagation();childAction()"></div>
</div>