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.

The example as below,

<!DOCTYPE html>
<html>

<head>
  <meta charset="utf-8" />
  <title>AngularJS Plunker</title>
  <link rel="stylesheet" href="style.css" />
  <script src="https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.4.7/angular.min.js" data-semver="1.4.7"></script>
  <script>
    var app = angular.module('helloApp', []);

    app.controller('HelloCtrl', ["$scope", function($scope) {
      $scope.name = 'Avanish';

      $scope.students = [{
        Id: 1,
        Name: 'Anil'
      }, {
        Id: 2,
        Name: 'Avanish'
      }, {
        Id: 3,
        Name: 'Alok'
      }]
    }]);
  </script>
</head>

<body ng-app="helloApp" ng-controller="HelloCtrl">
  <p>Hello {{name}}</p>
</body>

</html>

The Output as below,

About Blogger

ANIL SINGH

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...
http://www.code-sample.com
http://www.code-sample.xyz

    Blogger Comment
    Facebook Comment

0 comments:

Post a Comment

SQL Server NodeJs TypeScript JavaScript Angular SQL Server My Book