AngularJS: How do I render HTML in an ng-repeat?
Rendering HTML with Angular should be a simple task - ng-bind-html should do the trick. (see here).
However, I was struggling to do the same thing in an 'ng-repeat'. I tried using $sanitize, but that did not work. Eventually, I found the solution on stackoverflow: instead of having the iteration sitting above the rendering, one can consolidate the two to produce the required result.
So
<span ng-repeat="item in items" me-update-flexslider="y">
<span class="ng-bind-html:{{item}}"></span>
</span>
<span ng:repeat="item in items" ng-bind-html="item"></span>
However, I was struggling to do the same thing in an 'ng-repeat'. I tried using $sanitize, but that did not work. Eventually, I found the solution on stackoverflow: instead of having the iteration sitting above the rendering, one can consolidate the two to produce the required result.
So
<span ng-repeat="item in items" me-update-flexslider="y">
<span class="ng-bind-html:{{item}}"></span>
</span>
became
<span ng:repeat="item in items" ng-bind-html="item"></span>
Comments
Post a Comment