<!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>
We use cookies to provide and improve our services. By using our site, you consent to our Cookies Policy. Accept Learn more