AngularJS expressions are like JavaScript expressions: They can contain literals, operators, and variables.
Example {{ 10 * 10 }} or {{ firstName + ” ” + lastName }}
-
Include angular.min.js
-
ng-app directive initialize the angular app
Example : 1
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
<!DOCTYPE html> <html> <script src="https://code.angularjs.org/1.6.9/angular.min.js"></script> <body> <div ng-app> <p>Expression: {{ 10 * 10 }}</p> </div> </body> </html> |
Example : 2
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
<!DOCTYPE html> <html> <script src="https://code.angularjs.org/1.6.9/angular.min.js"></script> <body> <div ng-app ng-init="quantity=45;btc=527071.34" > <p>Total Balance: {{ btc * quantity }} INR</p> </div> </body> </html> |
Example : 3
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
<!DOCTYPE html> <html> <script src="https://code.angularjs.org/1.6.9/angular.min.js"></script> <body> <div ng-app ng-init="string1='WeAnswer';string2='- web developer question & answer'" > <p>{{ string1 + " " + string2 }}</p> </div> </body> </html> |
Example : 4
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
<!DOCTYPE html> <html> <script src="https://code.angularjs.org/1.6.9/angular.min.js"></script> <body> <div ng-app ng-init="user={height:5.5,weight:60 }" > <p>{{ user.height * user.weight }}</p> </div> </body> </html> |
More Stories
AngularJS Dynamic Routes
Angular Demo Project
AngularJS Routes