I am using a dynamic component in my angular app. It's working fine but I want to change the html template it uses, For example in my dynamic component.ts I have:
@Component({
selector: 'app-dynamic',
template: '<p>Stackoverflow</p>' ,
styleUrls: ['./dynamic.component.css']
})
So in the decorator instead of a html string can I use a variable which I get from some other service that holds required html string ? like:
@Component({
selector: 'app-dynamic',
template: variablehavinghtml,
styleUrls: ['./dynamic.component.css']
})
I tried using templateUrl to link a html which has a div like:
<div [innerHTML]="variablehavinghtml"></div>
but as my variable can also have tags with angular property bindings it's not working so I have to give the html string inside my component decorator. So how can I do this?