Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
是否可以如本文所述将 ngClick 事件处理程序设置为捕获阶段。我想防止事件在捕获阶段满足父级条件时流向子级并再次冒泡。
在所有角度事件指令中,您都可以使用 $event 对象(它是 jquery/jquery-lite 事件对象)。所以,你可以这样做:
ng-click="someAction(); $event.stopPropagation()"