Is it possible to bind data of scope variable to a html that is about to bind as ng-bind-html?
ie, I have a
html =\"{{caption}}
You should use $interpolate not $compile.
Write controller like this:
angular.module('app', ['ngSanitize'])
.controller('MyCtrl', ['$scope', '$interpolate', function($scope, $interpolate){
$scope.caption = 'My Caption';
$scope.html = $interpolate('{{caption}}')($scope);
});
Then write HTML like this: