AngularJS - render HTML tags that are contained in a string

My database stores product information, and many of them are organized into lists. I am loading data into Angular as $scope.post .

For example,

 $scope.post.size_description = '<li> Fits true to size. Take your normal size\r</li> <li> Slim-cut, mid-rise style</li> <li> Long in length, alter to fit</li> <li> Model wears an IT 48\r</li> <li> Model measures: waist size 32, height 6\'1"/ 185cm\r</li>'. 

When I try to load this data into my Angular application, it becomes displayed as text (i.e., <li> not parsed). I understand that this probably happens for security reasons, but are there any ways around it?

+11
javascript html angularjs escaping
Jul 24 '13 at 6:31
source share
1 answer

As Damax said here: stack overflow

 <div ng-bind-html-unsafe="post.size_description"></div> 
+9
Jul 24 '13 at 6:42 on
source share
— -



All Articles