global
function
Retrieves directive instances associated with a given DOM node. Does not include component instances.
ng.getDirectives(node: Node): {}[]
node | Node | DOM node for which to get the directives. |
{}[]
: Array of directives associated with the node.
Given the following DOM structure:
<app-root> <button my-button></button> <my-comp></my-comp> </app-root>
Calling getDirectives
on <button>
will return an array with an instance of the MyButton
directive that is associated with the DOM node.
Calling getDirectives
on <my-comp>
will return an empty array.
© 2010–2021 Google, Inc.
Licensed under the Creative Commons Attribution License 4.0.
https://v12.angular.io/api/core/global/ngGetDirectives