I have a angularjs project where data come from database. and bind in html template. some data inserted from text editor, and i need to show the data in html template like @html.raw in mvc. is it possible.
3 Answers
Check out the angular-sanitize module. I've created a plunk to demonstrate how it works: Check this plunk
<body ng-app="app" ng-controller="testController">
<div ng-bind-html="customHtmlContent">
</div>
</body>
angular.module('app', ['ngSanitize']).controller('testController',
function($scope, $sanitize){
$scope.customHtmlContent = $sanitize('<strong>Lorem ipsum dolor</strong>');
});
<p ng-bind-html="myHtmlVariable"></p>angular-sanitizelibrary, that's what it partially is made for