How to html code from ts, plz


#1

Hi
I want to render html from ts. is it possible ? for example I want below code in html

This is image <img src="img/appicon.png"> shows various part of the human figure

and I want this should be in .ts variable like

this.data="This is image <img src=\"img/appicon.png\"> shows various part of the human figure"

But when I do it in html like {{data}} it shows
This is image <img src="img/appicon.png"> shows various part of the human figure
as text and not showing image. How can I do that ?


#2

Angular really doesn’t want you to do this. See this issue.


#3

[innerHTML]=“data” and it is working well.