From Get docs
< @angular/core‎ | globalAngular/docs/11/api/core/global/nggetlisteners


global function

Retrieves a list of event listeners associated with a DOM element. The list does include host listeners, but it does not include event listeners defined outside of the Angular context (e.g. through addEventListener).

ng.getListeners(element: Element): Listener[]

element Element Element for which the DOM listeners should be retrieved.

Listener[]: Array of event listeners on the DOM element.

Usage notes

Given the following DOM structure:

  <div (click)="doSomething()"></div>

Calling getListeners on <div> will return an object that looks as follows:

  name: 'click',
  element: <div>,
  callback: () => doSomething(),
  useCapture: false

© 2010–2021 Google, Inc.
Licensed under the Creative Commons Attribution License 4.0.