Like JavaScript expressions, AngularJS expressions can contain literals, operators, and variables.
Unlike JavaScript expressions, AngularJS expressions can be written inside HTML.
AngularJS expressions do not support conditionals, loops, and exceptions, while JavaScript expressions do.
AngularJS expressions support filters, while JavaScript expressions do not.
Example:
<!DOCTYPE html>
<html>
<script src="http://ajax.googleapis.com/ajax/libs/angularjs/{version}/angular.min.js"></script>
<body>
<div ng-app="" ng-init="quantity=1;cost=5">
<p>My first expression: {{ 15 + 10 }}</p>
<p>Total in dollar: {{ quantity * cost }}</p>
1 Comment(s)