AngularJS binds data to HTML using Expressions.
AngularJS Expressions
Note : all angular expression must be under the ng-app directive
<!DOCTYPE html>
AngularJS Expressions
AngularJS expressions are written inside double braces: {{ expression }}.
AngularJS expressions binds data to HTML the same way as the ng-bind directive.
AngularJS will "output" data exactly where the expression is written.
AngularJS expressions are much like JavaScript expressions: They can contain literals, operators, and variables.
Example {{ 5 + 5 }} or {{ firstName + " " + lastName }}
Note : all angular expression must be under the ng-app directive
The below is the live example for understanding expressions in angular js..
<!DOCTYPE html>
<html lang="en" ng-app="myapp">
<head>
<meta charset="UTF-8">
<title>Anuglar js First Example</title>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.7/angular.min.js"></script>
</head>
<body>
<div>
<input type="text" ng-model="price" placeholder="Enter price">
<input type="text" ng-model="quantity" placeholder="Enter quantity">
Total Payable amount is {{price*quantity} }
</div>
</body>
<script>
var app = angular.module('myapp', []);
</script>
</html>
Output
Total Payable amount is {{price*quantity}}
0 comments:
Post a Comment