Please note, this is a STATIC archive of website www.tutorialspoint.com from 11 May 2019, cach3.com does not collect or store any user information, there is no "phishing" involved.
Tutorialspoint

Expression Init Eval Demo

<!doctype html>
<html ng-app="ExpressionDemoApp">
  <head>
    <script src = "https://ajax.googleapis.com/ajax/libs/angularjs/1.7.5/angular.min.js"></script>

  </head>
  <body>
    <div ng-controller="ExpressionController" ng-init="person={firstname:'Ashish' ,lastname:'Sahu'}">
        Addition: {{addition}}<br>
        First Name : {{person.firstname}} <br>
        Last Name  : {{person.lastname}}
    </div>
    <script>
        var app=angular.module("ExpressionDemoApp",[]);
        app.controller("ExpressionController",function($scope){
            $scope.a=5;
            $scope.b=10;
            $scope.addition=$scope.$eval('a+b');
        });
        
    </script>
  </body>
</html>

Advertisements
Loading...

We use cookies to provide and improve our services. By using our site, you consent to our Cookies Policy.