title: AngularJS Uncaught Type Error: cannot read property 'notify' of undefined && controller reads the html form values as NULL
body: <p>I am a beginner in AngularJS. I am implementing a CRUD application for practice.It has a single student table with name,password,email and phone fields.I am using MySQL as my database.
  My application should work as follows:
  The HTML page reads values of fields and passes these values to controller.js,which then calls the servlet.The servlet then connects to the database and inserts these values.Currently I am using $http.post() to call the servlet.The values should be passed to the servlet in JSON format.</p>
  
  <p>According to what I have learnt,the values from HTML forms are read using $scope.But the values of form elements are null in my controller.js.
  HERE is my HTML text input element:</p>
  
  <pre><code>&lt;form name="regform" role="form" class="form-signin" action='InServlet'&gt;
    &lt;input type="text" class="form-control" id="n1" name="name" placeholder="Enter Name"
             ng-model="std.name" ng-model-instant required autofocus/&gt; 
    &lt;input type="password" class="form-control" id="n2" name="pwd" placeholder="Enter Password" required ng-model="std.pwd" ng-model-instant  maxlength="8"/&gt;
    &lt;input type="email" class="form-control" id="n3" name="mail" placeholder="Enter Email" required ng-model="std.mail" ng-model-instant /&gt;
    &lt;input type="text" class="form-control" id="n4" name="phone" placeholder="Enter Phone" required minlength="10" maxlength="14" ng-model="std.phone" ng-model-instant /&gt;
  
    &lt;button name="save" id="save" type="submit" class="btn btn-md btn-primary"
              ng-disabled="regform.$invalid" 
              ng-Click="callInHttp(std)"&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>HERE is controller.js where I read the value of </p>
  
  <pre><code>angular.module('appcontrollers', [])
  .controller('MyCtrl2', ['$scope','$http', function($scope,$http,jsonFilter)
    {
    $scope.callInHttp=function($scope,std)
          {
             alert("std:"+$scope.std);   --&gt;THIS DISPLAYS UNDEFINED
             .....
             /**CODE to call servlet**/
          }
    }
  </code></pre>
  
  <p>The error in the browser log says:
  " Uncaught TypeError: Cannot read property 'notify' of undefined ".</p>
  
  <p>I need help regarding the following:
  1)Please tell me where am I making the mistake in reading HTML form input values and how I should correct it.
  2)How should I convert the HTML form input values into JSON format in angularjs?
  3)How to send the JSON data to java servlet?
  4)How should the Servlet convert the JSON data to strings so as to insert the data into database?</p>
  
  <p>Any help is appreciated.Thanks in advance.</p>