Cookies concent notice

This site uses cookies from Google to deliver its services and to analyze traffic.
Learn more
Skip to main content
Say hello to Angular's future home!Check out Angular.devHome
/

ng.getDirectives

Retrieves directive instances associated with a given DOM node. Does not include component instances.

      
      ng.getDirectives(node: Node): {}[]
    
Parameters
node Node

DOM node for which to get the directives.

Returns

{}[]: Array of directives associated with the node.

Usage notes

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.