Angular addEventListener with options

Discussão em 'Angular' iniciado por Jun, Dezembro 2, 2024.

  1. Jun

    Jun Guest

    How to use addEventListener function with options with Angular 5? If there is document, could you please point me to it? Thanks

    target.addEventListener(type, listener[, options]);
    target.addEventListener(type, listener[, useCapture]);


    Angular way of listening to event method don't seem to allow that.

    inside HTML template

    <div (click)='handleClick()'/>


    Angular renderer2 listen method:

    listen(target: 'window' | 'document' | 'body' | any, eventName: string, callback: (event: any) => boolean | void): () => void


    HostListener

    @HostListener({
    eventName?: string
    args?: string[]
    })

    Continue reading...

Compartilhe esta Página