填写这份《一分钟调查》,帮我们(开发组)做得更好!去填写Home

ng.getListeners

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[]
      
      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.

使用说明

Given the following DOM structure:

<my-app> <div (click)="doSomething()"></div> </my-app>
      
      <my-app>
  <div (click)="doSomething()"></div>
</my-app>
    

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

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