daniel daniel - 2 months ago 9
Javascript Question

Add html in *ng-for loop in angular 2

I want to add html code from a variable inside a for loop in angular 2:

<ul>
<li *ng-for="#c of myHtmlItems">
{{c.myHtml}}
</li>
</ul>


The html is only added as a string

kit kit
Answer

you could do:

<ul>
    <li *ng-for="#c of myHtmlItems" inner-html="{{c.myHtml}}></li>
</ul>