AngularJS Example
HTML
<div ng-app="bindhtml">
<div ng-controller="bindhtmlctrl">
<p ng-bind-html="myHTML" ></p>
<ul>
<li ng-repeat="i in items" ng-bind-html="getHtml(i.htmlval)"></li>
</ul>
</div>
</div>
CSS
</style> <!-- Ugly Hack to make remote files preload in jsFiddle -->
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/angularjs/1.2.3/angular.js"></script>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/angularjs/1.2.3/angular-sanitize.min.js"></script>
<style>
JavaScript
angular.module('bindhtml', ['ngSanitize'])
.controller('bindhtmlctrl', ['$scope','$sce', function ngBindHtmlCtrl($scope, $sce) {
$scope.myHTML = $sce.trustAsHtml('<b>some</b> html');
$scope.items = [{htmlval: "<b>some</b> html"}, {htmlval: "<b>some</b> other html"}];
$scope.getHtml = function(v){
return $sce.trustAsHtml(v);
};
}]);