Given the following innerHtml
statement in a template:
<div [innerHtml]="content"></div>
and the following code in the component:
this.content = '<a href (click)="clickMe()">Click Me</a>;'
clickMe(){
alert('link was clicked');
}
Clicking on the link does nothing, as the anchor is not compiled. How to make Angular aware of the (click)
event? In AngularJS I used $compile
but I couldn't find an equivalent in Angular 6.