What's the best way to cancel event propagation between nested ng-click calls?

后端 未结 10 1607
旧时难觅i
旧时难觅i 2020-11-30 18:40

Here\'s an example. Let\'s say I want to have an image overlay like a lot of sites. So when you click a thumbnail, a black overlay appears over your whole window, and a la

10条回答
  •  野趣味
    野趣味 (楼主)
    2020-11-30 19:27

    If you insert ng-click="$event.stopPropagation" on the parent element of your template, the stopPropogation will be caught as it bubbles up the tree, so you only have to write it once for your entire template.

提交回复
热议问题