I am using ng-bind-html
for binding data that I get from database.
app.controller(\'customersC
This is where directives come in very handy. Why not append the HTML yourself and then run the highlighter?
Template:
Directive:
.directive('highlight', [
function () {
return {
replace: false,
scope: {
'ngModel': '='
},
link: function (scope, element) {
element.html(scope.ngModel);
var items = element[0].querySelectorAll('code,pre');
angular.forEach(items, function (item) {
hljs.highlightBlock(item);
});
}
};
}
]);
Example: http://plnkr.co/edit/ZbcNgfl6xL2QDDqL9cKc?p=preview