0

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 is not showing it

I've created this jsFiddle to demonstrate my issue.

selva
  • 1,175
  • 1
  • 19
  • 39
reza pr2
  • 23
  • 1
  • 3

1 Answers1

0

Create a filter for trusting the content

<div ng-bind-html="myData | trustAs"></div>

angular.module('app').filter('trustAs', ['$sce', 
    function($sce) {
        return function (input, type) {
            if (typeof input === "string") {
                return $sce.trustAs(type || 'html', input);
            }
            console.log("trustAs filter. Error. input isn't a string");
            return "";
        };
    }
]);

original answer https://stackoverflow.com/a/34783962/3769965

working fiddle : https://jsfiddle.net/ebinmanuval/LL5mr7tw/1/

Community
  • 1
  • 1
Ebin Manuval
  • 1,235
  • 14
  • 33