AngularJS | Expressions
Expressions in AngularJS are used to bind application data to HTML. The expressions are resolved by Angular and the result is returned back to where the expression is written. The expressions in AngularJS are written in double braces: {{ expression }}. They behave similar to ng-bind directives: ng-bind=”expression”.
Syntax:
{{ expression }}
Example: This example displays the name that we feed in the ng-init directive.
<!DOCTYPE html> <html> angular.min.js"></script> <head> <title>AngularJS Introduction</title> </head> <body style = "text-align:center"> <h2 style = "color:green">AngularJS Expressions</h2> <div ng-app="" ng-init="name='GeeksforGeeks'"> <p> {{ name }} is a portal for geeks.</p> </div> </body> </html> |
Output:

Example 2: This example displays the content of the object that we feed in ng-init directive.
<html> angular.min.js"></script> <head> <title>AngularJS Introduction</title> </head> <body> <h2 style = "color:green">AngularJS Expressions</h2> <div ng-app="" ng-init="sort={one:'quick sort', two:'merge sort', three:'bubble sort'}"> <p> Sorting Algorithms: <ul> <li>{{ sort.one }}</li> <li>{{ sort.two }}</li> <li>{{ sort.three }}</li> </ul> </div> </body> </html> |
Output:

Recommended Posts:
- Output of PHP programs | Set 1 (Regular Expressions)
- AngularJS | API
- AngularJS | Forms
- AngularJS | Animations
- AngularJS | ng-src Directive
- AngularJS | Services
- AngularJS | ng-value Directive
- AngularJS | HTML DOM
- AngularJS | Tables
- AngularJS | Includes
- AngularJS | How to use ng-idle?
- What are the AngularJs Global API?
- AngularJS | Scope
- AngularJS | Directives
- AngularJS | Modules
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.



