I have a backend rendered template that returns a JSON object that contains a string that needs some dynamic data bindings for example...
sampleLogic = {
"1": "Sample static text and some {{ dynamic_text }}."
}
By default the string is escaped, what's the best way in angular to convert dynamic_text to bind to $scope.dynamic_text?
JS:
var sampleLogic = {
"1": "Sample static text and some {{ dynamic_text }}."
};
function parseMe($scope) {
$scope.copy = sampleLogic['1'];
$scope.dynamic_text = "dynamic text woooot";
}
HTML:
<div ng-app>
<div ng-controller="parseMe">
<div ng-bind-html-unsafe="copy"></div>
</div>
</div>
Fiddle: http://jsfiddle.net/RzPM3/