Rendering HTML with angular
HTML
<h2>Rendering HTML with angularJS</h2>
<div ng-app="angularApp" ng-controller="appController">
<div ng-bind-html="content | html"></div><br />
</div>
JavaScript
var app = angular.module("angularApp", []);
app.controller("appController", function($scope, $sce){
$scope.content = "This text is <em>html capable</em> meaning you can have <a ng-click='updateRating(1)' href=\"#\">all</a> sorts <b>of</b> html in here.";
$scope.updateRating = function(item) {
console.log("test "+item)
};
$scope.bindHTML = $sce.trustAsHtml($scope.content);
});
app.filter('html', function($sce) {
return function(val) {
return $sce.trustAsHtml(val);
};
});