Pass html tag from object in ng-repeat

How to render html tag from object in ng-repeat.

list[2] = { "text": "This is a text with a html tag on a <i>word</i>" }

I need that when this object is used on ng-repeat, the tag will render as expected.

You can use the "ng-bind-html"
for example

<li ng-repeat="x in names">
     <p ng-bind-html="x.text"></p>
</li>

or you can look into
https://docs.angularjs.org/api/ngSanitize/service/$sanitize

4 Likes