Style not working for innerHTML in Angular

Viewed 124933

I am passing html as innerHtml to my view. Below is my view

<div [innerHTML]="someHtmlCode"></div>

if I pass the below code, it is working fine.

this.someHtmlCode = "<div><b>This is my HTML.</b></div>"

if I pass the below code which contains color, it is not working.

 this.someHtmlCode = '<div style="background-color: blue;"><b>This is my HTML.</b></div>';
3 Answers
Related