Angularjs Examples

AJS Examples


AngularJS ng-bind-html Directive

The ng-bind-html directive is used to bind inner HTML property of an HTML element.

Syntax

<p ng-bind-html="myHTML"></p> 

AngularJS ng-bind-html Directive Example

<html>
<head>
<title>My first AngularJS code</title>
<script SRC="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.13/angular.js">
<script src="//ajax.googleapis.com/ajax/libs/angularjs/1.4.0-beta.6/angular-sanitize.js"></script>
</script>
<script>
//Defining Controller Using Standard Javascrip Object Constructor
  //Defining Controller Using AngularJS Module  
var app = angular.module('yourApp', ['ngSanitize']);  
    app.controller('CustomerController', function($scope) {  
        $scope.myHTML = 'This is HTML bind example 
		
		AngularJS Built in Directives'; 
    });
</script>
</head>
<body>
<div ng-app="yourApp">
<div ng-controller="CustomerController"> 
<p ng-bind-html="myHTML"></p>

</div>
</div>
</body>
</html>
See Live Example