javascript - how to pass value in angular js in jsp/servlet -


i developing module in jsp/servlet in need use angular js. how pass value input box value in function how send value in servlet also...!

here example of code:-

 <%@page contenttype="text/html" pageencoding="utf-8"%>   <!doctype html>   <html ng-app="mehandi" >   <head>     <meta http-equiv="content-type" content="text/html; charset=utf-8">     <title>jsp page</title>         <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.3/angular.min.js">        </script>      <script>         var app = angular.module('mehandi', []);         app.controller('mhndictrl', function($http){             var xyz = this;             xyz.data = {}             xyz.swati = function($http){               }          })       </script>   </head>   <body ng-controller="mhndictrl abc" >     <h1>hello world!</h1>     <input type="text" ng-model="abc.data.myname">     {{abc.data}}     <button ng-click="abc.swati()" > </button>    </body> </html> 

you can invoke function via ng-init: in html

ng-init="init('${userdto.username}')" 

so, in *.js ng-controller following:

$scope.init = function(username){    /*logic code*/ }; 

Comments