Parse your HTML data in AngularJS

ngSanitize 

AngularJS provides ngSanitize module to securely parse and manipulate HTML data in your application. To use it include the angular-sanitize.js file and set ngSanitize as a dependency in your angular app.



var app = angular.module('sanitizeExample', ['ngSanitize']); app.controller('ExampleController',function ($scope, $sce)
{
   var snippet ='an html\n' + 'click here\n snippet'; 
   $scope.trustedSnippet = $sce.trustAsHtml(snippet); //sce=Strict Contextual Escaping 
});

No comments

Powered by Blogger.