Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to render an innerHTML without adding a tag in Angular

<div [innerHTML]="'<b>HEY</b>'"></div>

Works well! But the problem is that I don't want the div or any other element to add to the page. I just want to render innerHTML content to page. I tried ng-container instead of div but it is not working. How can I make it happen ?

like image 372
canmustu Avatar asked Jun 07 '26 10:06

canmustu


1 Answers

You can use [outerHTML] on the div and it will be replaced.

<div [outerHTML]="'<b>HEY</b>'"></div>
like image 96
Melchia Avatar answered Jun 08 '26 22:06

Melchia



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!