简体   繁体   中英

How to find directive name for given DOM element

Suppose you have some custom directive myDirectiveA and associated controller myControllerA with replace : true - it means that your custom directive name will not appear in DOM tree.

How to find a directive name in this case?

(Something like angular.element($0)... ?)

PS I know that replace:true is deprecated.

I still haven't found a way to do this, so I assume it's not possible. However, it's possible to get controller:

angular.element($0).controller()

or a component's controller

angular.element($0).scope().$ctrl

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM