member555
member555

Reputation: 807

How to print html from angularjs expression?

Lets suppose I want to print the following html:

<a href..?> </a>

and I have it inside some expression.

how can I print it so it will be clickable using {{x.something}} in angular js ng-repeat?

Upvotes: 0

Views: 1075

Answers (1)

Davin Tryon
Davin Tryon

Reputation: 67296

You can do 1 of 2 things.

  1. Use $sce service with the ng-bind-html attribute. $sce requires that you call $sce.trustAsHtml() around the html content before binding to the UI.
  2. Use ngSanitize (by adding it as a dependent module) and then use ng-bind-html

Upvotes: 2

Related Questions