Sunday, May 19, 2024
 Popular · Latest · Hot · Upcoming
159
rated 0 times [  161] [ 2]  / answers: 1 / hits: 32702  / 12 Years ago, tue, july 10, 2012, 12:00:00

I'm using AngularJS with a third party service that generates html responses. I want to use ng-repeat to render the HTML responses as a list, however Angular renders it as text.



Is it possible to use ng-repeat to render HTML property?



I've created this jsFiddle to demonstrate my issue.
http://jsfiddle.net/DrtNc/1/


More From » html

 Answers
49

I think using ng-bind-html-unsafe will get you what you need.



<div ng:repeat=item in items ng-bind-html-unsafe=item.html></div>


Here's a working fiddle: http://jsfiddle.net/nfreitas/aHfAp/



Documentation for the directive can be found here: http://docs.angularjs.org/api/ng.directive:ngBindHtmlUnsafe


[#84360] Monday, July 9, 2012, 12 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
zaynerogerb

Total Points: 454
Total Questions: 109
Total Answers: 97

Location: Comoros
Member since Tue, Mar 14, 2023
1 Year ago
zaynerogerb questions
;