title: $scope variables are not working inside $scope function in AngularJS
body: <p>Scope variable returns undefined value when using inside same Scope function.</p>
  
  <p><em>index.html</em></p>
  
  <pre><code>&lt;body ng-app="starter" ng-controller="AppCtrl"&gt;
                  &lt;form ng-submit="submit()"&gt;
                          &lt;span class="input-label"&gt;name&lt;/span&gt;
                          &lt;input type="text" name="name" ng-model="name"&gt;     
                          &lt;input type="submit" name="submit" value="Submit"&gt;                    
                  &lt;/form&gt;
  &lt;/body&gt;
  </code></pre>
  
  <p><em>app.js</em></p>
  
  <pre><code>angular.module('starter', [])
  .controller('AppCtrl', function($scope) {
      $scope.submit = function(){
          alert($scope.name+' scope variable');
              }});
  </code></pre>
  
  <p><em>output:</em></p>
  
  <pre><code>undefined scope variable
  </code></pre>