Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

162
Views
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 answers
Answer question

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 Report

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!