I am new to angular js. So this might be very basic question
I have external API data which is a user generated content. The client wants to dynamically show the content. In content, there is script in which directive is created, I tried using ng-bind-html but it doesn't work.
<div ng-bind-html="myHTML"></div>
want to execute the script in which directive is created and same directive should be injected in html content.
var data = '<script> var app = angular.module(\'main\', []);' +
'app.directive(\'slideImageComparison\', function () {return { restrict: \'E\', scope: { imageInfo: \'=info\'}, link: function (scope, elem, attr) { console.log(\'directive called\');' +
'},template: \'<div class="slide-comb"> test </div>\'' +
'}; }); </script> <slide-image-comparison></slide-image-comparison>';
$scope.myHTML= $sce.trustAsHtml(data)
I added backslash to escape a single quote.
help is appreciated here.