I have html template like this:
I want to bind this template using "ng-bind-html", like below:
angular.module('bindHtmlExample', ['ngSanitize'])
.controller('ExampleController', ['$scope', '$compile',
function($scope, $compile) {
var templateHTML =
'I am an <code>HTML</code>string with ' +
'<span class="pointer"><i class="icon-refresh pointer" ng-click="refresh()"></i></span>';
$scope.myHTML = $compile(templateHTML)($scope);
}
]);
<script src="//ajax.googleapis.com/ajax/libs/angularjs/1.3.0-rc.3/angular.js"></script>
<script src="//ajax.googleapis.com/ajax/libs/angularjs/1.3.0-rc.3/angular-sanitize.js"></script>
<div ng-app="bindHtmlExample">
<div ng-controller="ExampleController">
<p ng-bind-html-unsafe="myHTML"></p>
<p ng-bind-html="myHTML"></p>
</div>
</div>
nothing I'm getting. How to fix this.