I want to append htmlString in a div tag.
app.component.ts file,
public htmlString:string = '';
this.htmlString:string = '<img id="img" src="assets/imgages/image.jpg">
<script>
document.getElementById("img").onclick = function(){
alert('click on image');
};
</script>';
app.component.html
<div></div>
I have used below code but script return as a plain text.
<div [innerHTML]="htmlString"></div>
How to solve it?