Home » AngularJS ng-bind-htm Directive

AngularJS ng-bind-htm Directive

by Online Tutorials Library

AngularJS ng-bind-html Directive

The AngularJS ng-bind-html directive is used to bind content to an HTML element securely.

It evaluates the expressions and inserts the resulting HTML into the element in a secure way. By default, the resulting HTML content will be sanitized using the $sanitize service. You have to include ngSanitize in your module’s dependencies to utilize this functionality. So “angular-sanitize.js” must be in your application.


Parameter explanation:

expression: It specifies a variable or an expression to evaluate.

Let’s take an example to demonstrate the ng-bind-html directive.

See this example:

Test it Now

You may also like