Expressions in Angular JS are used to bind application data to html. Expressions are written inside double braces like {{ expression}} or can be use in the ng-bind directives.

Example of Angular Expressions Using Number.

<!DOCTYPE html>
<html>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.4/angular.min.js"></script>
<body>

<div ng-app="" ng-init="number1=10;number2=50">
<p>Total using double braces {{expression}}: {{ number1 + number2 }}</p>

<p>Total using ng-bind directives: <span ng-bind="number1+number2"/></p>
</div>

</body>
</html>

In this program we have used expressions using number with {{ expression}} and ng-bind directives.

Output.

Total using double braces : 60

Total using ng-bind directives: 60

Example of Angular Expressions Using String.

<!DOCTYPE html>
<html>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.4/angular.min.js"></script>
<body>

<div ng-app="" ng-init="login='admin'; password='admin123'">
<p>Display string using double braces {{expression}}: {{ login +':' +password }}</p>

<p>Display string using ng-bind directives: <span ng-bind="login + ':'+password"/></p>
</div>

</body>
</html>

In this program we have used expressions using string with {{ expression}} and ng-bind directives.

Output.

Display string using double braces : admin:admin123

Display string using ng-bind directives: admin:admin123

Example of Angular Expressions Using Object.

<!DOCTYPE html>
<html>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.4/angular.min.js"></script>
<body>

<div ng-app="" ng-init="User={login:'admin', password:'admin123'}">
<p>Display using double braces {{expression}}: {{ User.login +':'+ User.password }}</p>

<p>Display using ng-bind directives: <span ng-bind="User.login + ':' +User.password"/></p>
</div>

</body>
</html>

In this program we have used expressions using Object with {{ expression}} and ng-bind directives.

Output.

Display using double braces : admin:admin123

Display using ng-bind directives: admin:admin123

Example of Angular Expressions Using Array.

<!DOCTYPE html>
<html>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.4/angular.min.js"></script>
<body>

<div ng-app="" ng-init="numbers=[0,1,2,3,4,5,6,7,8,9]">
<p>Display array element using double braces {{expression}}: {{ numbers[1] }}</p>

<p>Display array element using ng-bind directives: <span ng-bind="numbers[1]"/></p>
</div>

</body>
</html>

In this program we have used expressions using Array with {{ expression}} and ng-bind directives.

Output.

Display array element using double braces : 1

Display array element using ng-bind directives: 1