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

Online AngularJS Editor

<!doctype html>
<html >
  <head>
    <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.3.3/angular.min.js"></script>
     <script>
   
    var app=angular.module("mymodule",[]);
    app.controller("mycontroller",function($scope){
       $scope.name="Sravya";
       $scope.totalvalue=0;
       $scope.displaytotalvalue=function(){
           totalvalue=calculate($scope.name);
       }
        
    });
    
    calculate= function(string){
        var total=0;
        for(int i=0;i<string.length;i++){
            total+= string.charCodeAt(i);
        }
        
        return total;
    }
    
    </script>
  </head>
  <body>
    <div ng-app="mymodule" ng-controller="mycontroller">
      <label>Name:</label>
      <input type="text" ng-model="name" placeholder="Enter a name here" ng-keyup="displaytotalvalue();">
      
      sum up value is :{{totalvalue}}
      
      <h1>Hello {{name}}</h1>
    </div>
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    <!-- calculator js file -->
    
   
    
    </body>
    </html>
    
    
    

Advertisements
Loading...

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