title: $scope.variable is undefined in browser console while form submit AngularJs
body: <p>I want <code>$scope.variable</code> value in browser console but its always occur undefined.</p>
  
  <p>form.htm</p>
  
  <pre><code>&lt;form&gt;
  &lt;p&gt;First Name: &lt;input type="text" name="firstName" ng-model="firstName" 
  required /&gt;&lt;/p&gt;
  
  &lt;button ng-click="SendData()"&gt;Submit&lt;/button&gt;
  &lt;/form&gt; 
  </code></pre>
  
  <p>myctr.js</p>
  
  <pre><code>app.controller('myCtrl', ['$scope', '$http', 'ngCart', '$localStorage',
   '$sessionStorage', '$window',
   function($scope, $http, ngCart, $localStorage,
       $sessionStorage, $window) {
       $scope.SendData = function() {
           console.log($scope.firstName)
           $window.alert($scope.firstName)
       };
   }
  ]);
  </code></pre>