title: how to close modal after submit in angularjs
body: <p>i know have many result in this question but no one give work answer for me.</p>
  
  <p>html 1:</p>
  
  <pre><code>&lt;button class="basebtn logbtn" ng-click="openlog()"&gt;LOGIN&lt;/button&gt;
  &lt;button class="basebtn regbtn" ng-click="openreg()"&gt;SIGN UP&lt;/button&gt;
  </code></pre>
  
  <p>html 2:</p>
  
  <pre><code>&lt;div ng-controller="main"&gt;
  &lt;center&gt;&lt;img class="img-login" ng-src="../images/form-logo.png"/&gt;&lt;/center&gt;
  &lt;form class="login" name="log" ng-submit="login()" novalidate&gt;
      &lt;div class="form-group  login-form" ng-class="{'has-error' : isInvalid(log.email) ,'has-success' : isValid(log.email)}"&gt;
          &lt;input type="email" class="form-control" name="email" ng-model="user.email" required placeholder="Email"&gt;
          &lt;div class="alert alert-danger" role="alert" ng-show="isInvalid(log.email)"&gt;Enter valid email&lt;/div&gt;
      &lt;/div&gt;
      &lt;div class="form-group  login-form" ng-class="{'has-error' : isInvalid(log.password) ,'has-success' : isValid(log.password)}"&gt;
          &lt;input type="password" class="form-control" name="password" ng-model="user.password" required placeholder="Password"&gt;
          &lt;div class="alert alert-danger" role="alert" ng-show="isInvalid(log.password)"&gt;This Feild is required&lt;/div&gt;
      &lt;/div&gt;
      &lt;div class="form-group" style="text-align:center;"&gt;
          &lt;input type="submit" class="logbnt" value="LOGIN" ng-disabled="! log.$valid" data-dismiss='modal'/&gt;
      &lt;/div&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p></p>
  
  <p>angular :</p>
  
  <pre><code>    $scope.login = function(){
      $http.post("www.example.com/login",$scope.user).then(function(res){
          localStorage.setItem("token",res.data.token);
          //how i close the modal ???
      });
  }
  
  //here create the modal
  $scope.openlog = function () {
          $scope.$modalInstance = $uibModal.open({
          templateUrl:"login.html",
      });
  }
  </code></pre>
  
  <p>that my code , how i close in $http result the modal ? </p>