문제

i got the following structure:

<div directiveA>
    <a href="" directiveB>
</div>

Both directives got an onclick event. The problem is, that if a click on directiveB is performed, a click on directiveA is triggered as well.

How can i prevent this?

Thanks

도움이 되었습니까?

해결책

In the directiveB on the click directive do this this

ng-click=doSomething();$event.stopPropagation()

There is an $event object available for all DOM events supported by angular.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top