Click Action In An Innerhtml Using Angular4 Not Working
I am trying to put an anchor tag in an innerHTML and I am using angular 4. in HTML file:
in Component: const myText = 'mytext go her
Solution 1:
This will not work, your code is fine but it's by design of Angular.
Whenever you pass some content via innerHTML
, Angular is just going to render that content does not evaluate any expression
or binding
within that content like you did by adding a click event.
So In order to achieve this (as per your requirement), you can wrap your content into another component and pass data via @input
property binding and display it into the browser.
For more detail you can read out here -
Post a Comment for "Click Action In An Innerhtml Using Angular4 Not Working"