How can I add a html element dynamically using string interpolation without add any html tag? Exp:
This is my obj in my component
myObj = { title: 'Header Title', icon: '<i class="fa fa-user">' } I want to add this like;
<header> {{myObj.title}} - {{myObj.icon}} </header> {{myObj.icon}} rendered as text, but I want render as html. How can?
I want the result to be as follows
<header> Header Title <i class ="fa fa-user"></i> </header> and if I change my obj like this;
myObj = { title: 'Header Title', icon: '<mat-icon>search</mat-icon>' } render as
<header> Header Title <mat-icon>search</mat-icon> </header>
<header [innerHTML]="myObj.title + ' - ' + myObj.icon">. I don't know if it works for theitag however.