This post is from a low-reputation account and contains an unverified outbound link. Be cautious before clicking external links.

[FE] Angular 1 legacy: How to obtain the binding 'controller' from the element ?

Words
33
Reading
1 min
Listen
Play
8y

We can use angular.element($0).controller('someDirective') to accomplish this, refer to the API: https://docs.angularjs.org/api/ng/function/angular.element.

The angular.element($0) will expose the wrapped object by angular on the element, you can also get the "scope" or "isolateScope" of the element.

[FE] Angular 1 legacy: How to obtain the binding 'controller' from ... | Ecency