V
V
Vadim2019-06-26 10:28:27
JavaScript
Vadim, 2019-06-26 10:28:27

How to intercept angular click event with pure javascript?

There is a frontend, part of which is implemented in angular. There is a view tag in html , inside it everything is drawn by Angular, incl. and view buttons Task: use pure javascript to intercept clicks on such buttons. You don’t need to change the logic, let Angular work as expected, you just need to fix the click on the button and work it out. Is this even possible? <blabla></blabla><button class="apply-button">Apply</button>

Answer the question

In order to leave comments, you need to log in

2 answer(s)
0
0xD34F, 2019-06-26
@vshemarov

document.addEventListener('click', function(e) {
  const t = e.target;
  if (t.matches('button.apply-button') && t.closest('blabla')) {
    // ...
  }
});

A
Andrey Suha, 2019-06-26
@andreysuha

As usual via addEventListener

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question