I get HTML string from the server. Inside the HTML string, I added a button with Id, Text and an onclick event and set to innerHTML. On the UI, the button got created with Id and Text but the Onclick event not working in Angular 6.
Solutions Tried:
- Created a directive with a button on the template attached the directive inside the dynamic html
- Created a Component with button on the template attached the Component inside the dynamic HTML
In both, the above cases the button got created but event listener was not working.
And I googled a lot couldn't find a single working example or concrete solution to provide
Any solutions appreciated