I would like to insert this kind of code:
template = '<div style="background-image: url("/assets/images/hello_message.png");">TEST</div>'
but as soon as I inject it that way:
@ViewChild('root', { static: true }) element: HTMLDivElement;
ngOnInit(): void {
this.element.nativeElement.innerHTML = this.template;
}
it's getting parsed as
<div style="background-image: url(" assets="" images="" hello_message.png");"="">TEST</div>
I'm aware it's not safe without any kind of sanitization but I would like to do it that way. How to do it?