AngularJs ngBindHtml and $sce

In this blog post we will see how to use ngBindHtml directive in angularjs


Bind html directive is used evaluate and insert a HTML expression in secure way. bind html uses $sanitize service which need to be included as a separate library.

In the above code we how to use ng-bind-html

bind-html evaluates an expression and only insert html in a safe way. If you need to skip this secure check use
$scope.text = $sce.trustAsHtml(); where $sce is a service to be injected.