Angular interpolation syntax

What is an Angular interpolation directive?

In AngularJs while we use any expression we write them in double curly braces “{{ }}” so this double curly braces is also known as interpolation directive.


<!DOCTYPE html>

  <script data-require="angular.js@1.5.x" src="" data-semver="1.5.8"></script>
  <script src=""></script>
    var app = angular.module("myApp", ["ngSanitize"]);

    app.controller("myCtrl", ["$scope", "$interpolate", function($scope, $interpolate) {

      var myname = {
        name: "<strong>Anil Singh</strong>"

      var templateText = "Hello my name is {{name}} !";
      $scope.result = $interpolate(templateText)(myname);


<body ng-app="myApp" ng-controller="myCtrl">
  <div ng-bind-html="result"></div>
  <br/><a href="">For more..</a>


Live output,

About Blogger


Hey! I am Anil Singh. I am Active Blogger, Writer and Programmer. I love learning new technologies, programming, blogging and participating the forum discussions more...

    Blogger Comment
    Facebook Comment
SQL Server NodeJs TypeScript JavaScript Angular SQL Server My Book