S
S
Sergei Iamskoi2017-07-06 11:00:43
JavaScript
Sergei Iamskoi, 2017-07-06 11:00:43

How to intercept a javascript function through Angular 2?

I am learning Angular 2. I previously knew JQuery and JS superficially, so I mainly work with PHP. I'm doing a project on which I'm studying and faced a non-trivial task that I can't even google)
Essence: using http.get.map.subscribe I pull a page and display it on the screen via innerHTML. This block has an on-click handler: When you click on which, as expected, an error appears in the console:
<a href="#" onclick="locateTree('x1234')">Link</a>

Uncaught ReferenceError: locateTree is not defined
    at <anonymous>:1:1
(anonymous) @ VM20596:1

How can I intercept/declare this function? In general, what would I be able to process it in angular, in my component? So far, a good crutch with str_replace is just coming into my head - to replace this function with the angular syntax .. But, I hope, there are more elegant methods.

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question