Angular ng-click $event passes child element as target

后端 未结 3 2061
故里飘歌
故里飘歌 2021-02-19 10:06

For each td element in a table I have an attached ng-click. Here is the (simplified) html for each table cell:



        
3条回答
  •  一整个雨季
    2021-02-19 10:35

    Changing:

    angular.element(event.target)
    

    to:

    angular.element(event.currentTarget)
    

    fixed my issue.

    It seems to me using event.currentTarget is preferred to event.target in the majority of usage cases.

提交回复
热议问题