var app = angular.module('plunker', ['ngSanitize']);
app.controller('MainCtrl', function($scope,$sce) {
$scope.snippet = '<p style="color:blue">an html\n' +
'<em onmouseover="this.textContent=\'Siva Phaneendra\'" onmouseout="this.textContent=\'click here\'">click here</em>\n' +
'snippet</p>';
$scope.chengetrusthtml=function(){
return $sce.trustAsHtml($scope.snippet);
};
});
<!DOCTYPE html>
<html ng-app="plunker">
<head>
<meta charset="utf-8" />
<title>AngularJS Plunker</title>
<script>document.write('<base href="' + document.location + '" />');</script>
<link rel="stylesheet" href="style.css" />
<script src="https://code.angularjs.org/1.2.25/angular.js"></script>
<script src="https://code.angularjs.org/1.2.25/angular-sanitize.js"></script>
<script src="app.js"></script>
</head>
<body ng-controller="MainCtrl">
<p>Example on ng-Sanitize</p>
<textarea rows="10" columns="10" ng-model="snippet"></textarea>
<h2>Textarea data parsed with ngSanitize</h2>
<div ng-bind-html="snippet"></div>
<h2>Textarea data as trustedhtml</h2>
<div ng-bind-html="chengetrusthtml()"></div>
<h2>Textarea data parsed ng-bind</h2>
<div ng-bind="snippet"></div>
</body>
</html>
/* Put your css in here */