title: posting data through angular form without page reload in angular
body: <pre><code>$scope.createPermission= function(form){
      AppFactory.createNewPermission(form)
          .success(function(data) { 
  
              $scope.updatedPermissions = data;
  
              $scope.navMode='getPermission'
  
              var original = $scope.permission;
              $scope.reset(original);
              $scope.permission = {}; // clear the form 
          })
          .error(function(data) {
              console.log('Error in creating permission: ' + data);
          });
  
      $scope.Execute=function(id) {
          if($scope.navMode=='updatePermission') {
              $scope.editPermission(id);
          } else if($scope.navMode=='createPermission') {
              $scope.createPermission($scope.permission);
          }
      }
  }
  
  $scope.reset= function(original) {
      $scope.permission= angular.copy(original)
      $scope.form2.$setPristine(true);
      //$scope.form2.$setUntouched(true);
  }
  </code></pre>
  
  <p>HTML:</p>
  
  <pre><code>&lt;div class="row"&gt;
      &lt;div class="container col-sm-6 col-sm-offset-2" 
           ng-show="navMode == 'createPermission' || navMode=='updatePermission' || navMode=='getPermission'"&gt;
  
          &lt;div&gt;
              &lt;h1&gt;Permissions&lt;/h1&gt;
          &lt;/div&gt;
      &lt;/div&gt;
      &lt;form class="form2" ng-show="showHide('Create')" ng-if=""name="form2" ng-submit="Execute(permissionId)" novalidate&gt;
  
          &lt;div class="form-group" ng-class="{ 'has-success': form2.name.$valid &amp;&amp; submitted, 'has-error': form2.name.$invalid &amp;&amp; submitted }"&gt;
              &lt;label&gt;Permission Name&lt;/label&gt;
  
              &lt;input type="text" name="name" class="form-control" ng-model="permission.name" required/&gt;
              &lt;p class="help-block" ng-show="form2.name.$error.required &amp;&amp; submitted"&gt;
                  A permission name is required
              &lt;/p&gt;
          &lt;/div&gt;
  
          &lt;div class="row col-lg-offset-3"&gt;
              &lt;button class="btn btn-primary" ng-disabled="form2.$invalid" type="submit"&gt;Save&lt;/button&gt;
          &lt;/div&gt;
      &lt;/form&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>I have above piece of code in controller and is executed on submission of the form. Now , It does work fine on page reload but I can not add data through form back to back. I need to reload teh page everytime to post new data through the form.</p>
  
  <p>Why exactly is that ?</p>
  
  <p>How do I fix this?</p>