AngularJS Tutorial - Define variable in expression








The following code shows how to define variable in expression.

Example


<!DOCTYPE html>
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.13/angular.js"></script>
</head><!-- w  w  w .  j  av  a2s  .c o m-->
<body>
  <div ng-app>
    {{ i = 1 }}
    i = {{ m = k; k = j; j = i+1; i }}<br>
    j = {{j}}<br>
    k = {{k}}<br>
    m = {{m}}<br>
</div>

</body>
</html>

The code above is rendered as follows: