Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

132
Vistas
Can Angular use capture rather than bubbling to catch events?

I somehow need capture method to catch triggered events, but ($event) in template is triggered in bubbling method by default. Is there somewhere to change it?

about 4 years ago · Santiago Trujillo
2 Respuestas
Responde la pregunta

0

Currently this can only be done adding event handlers imperatively.

There are plans though to support that in the future

See

  • https://github.com/angular/angular/issues/11200
  • https://github.com/angular/angular/pull/13371
  • https://github.com/angular/angular/issues/13248
about 4 years ago · Santiago Trujillo Denunciar

0

One workaround is to use the naive approach and add an event listener in your component's constructor.

Then add 'true' as the 3rd parameter to achieve event capturing.

constructor() {

    document.addEventListener('click', (event) => {

      console.log(event);

    }, true);

}

Tip: use the fat arrow function to reference the correct 'this'

about 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda