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 ="<div>{{caption}}</div>";
and my angular template look like,
<div ng-bind-html="html"></div>
the value of scope variable caption
is set in angular controller.
So, I want to bind data in {{caption}}
.
Thanks in advance..
You should use $interpolate not $compile.
Write controller like this:
Then write HTML like this:
What about?
html = '<div ng-bind="caption"></div>';
You need to compile your HTML snippet, but it is recommended to do that inside the directive.