Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

164
Visualizações
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 Respostas
Responde à pergunta

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 Relatório

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda