The ng-bind-html Directive is used to bind the innerHTML of an HTML element to application data and remove dangerous code from the HTML string. $sanitize service is a must for ng-bind-html directive. It is supported by all HTML elements.
<element ng-bind-html="expression"> Contents... </element>
- Initialize the libraries that we are using. Here, we are mainly use angular-sanitize.js library.
- Create app and its controller scope.
- Define the contoller variable.
- Call the app and controller to body of html.
- Inside the body use span tag and use attribute ng-bind-html and assign the value as the scope variable.
- What is the difference between display: inline and display: inline-block in CSS?
- How to display length of filtered ng-repeat data in AngularJS ?
- How to display incorrect content using HTML5 ?
- How to dynamically get the content width of a div using AngularJS ?
- How to dynamically get the content height of a div using AngularJS ?
- How to get file content and other details in AngularJS?
- Projecting Content into Components with ng-content
- AngularJS | How to use ng-idle?
- What is the use of a double-click event in AngularJs?
- How to use filter within controllers in AngularJS ?
- Why do we use $rootScope.$broadcast in AngularJS?
- How to use *ngIf else in AngularJS ?
- How to use Bootstrap to align labels with content into 4 columns ?
- How to use a div as content for Twitter's Popover?
- AngularJS | ng-value Directive
- How to Reset an Input Value when Limit Exceeds using AngularJS ?
- How to display HTML tags as plain text using PHP
- HTML | DOM Style display Property
- Neon Text Display Using HTML & CSS
- How to fetch data from localserver database and display on HTML table using PHP ?
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.