Angularjs Examples

AJS Examples


What is Expression in AngularJS

In this AngularJS basic example you will learn what is expression notation {{}} and how to bind data from model to HTML DOM elements.

Here you can view the output of the example and you can also "try it yourself" by clicking on "Live Demo" button given at the bottom.

Syntax

{{  yourProperty  }}
{{  5 + 5  }}
{{ user.name }}

What is expression in AngularJS

<html ng-app="myApp">    
<head> <! -- www.techstrikers.com -->   
<title>My first AngularJS code</title>    
<Script SRC="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.13/angular.js">
</Script>    
<script>     
  //Create module  
  var app = angular.module("myApp",[]);  
  app.controller('myController', ['$scope', function($scope) {      
  $scope.a = 90;     
  $scope.b = 10;     
}]);   
</script>    
</head>    
<body>    
<p ng-controller="myController">  
a + b = {{  a + b  }}  </br>  
10 + 12  = {{  10 + 12  }}  
</p>    
</body>    
</html>