Angular HTML binding

14    10 months ago

I am writing an Angular application and I have an HTML response I want to display.

How do I do that? If I simply use the binding syntax {{myVal}} it encodes all HTML characters (of course).

I need somehow to bind the innerHTML of a div to the variable value.

Answers { 1 }
10 months ago

The correct syntax is the following:

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

Works on 8.1.2

Documentation Reference