johnbraum
johnbraum

Reputation: 296

HTML text in ionic list

i have following list:

<ion-list>
    <ion-item ng-repeat="item in productlistitems">
       {{ item.name }}!
    </ion-item>
</ion-list>

item.name is with HTML tags, but they appear as plain text.

How can I achieve that the HTML code gets "executed"?

Upvotes: 1

Views: 394

Answers (1)

Matt M
Matt M

Reputation: 3779

In order to render HTML, use the "ng-bind-html" directive like this:

<div ng-bind-html="item.name"></div>

In your controller, you need to "trust" the data using the $sce service like this:

$scope.item.name = $sce.trustAsHtml("your HTML here");

Upvotes: 2

Related Questions