0
私はこの質問に多くの結果があることを知っていますが、誰も私の仕事の答えを与えるものはありません。angularjsでサブミットした後にモーダルを閉じる方法
htmlの1:
<button class="basebtn logbtn" ng-click="openlog()">LOGIN</button>
<button class="basebtn regbtn" ng-click="openreg()">SIGN UP</button>
はhtmlの2:
<div ng-controller="main">
<center><img class="img-login" ng-src="../images/form-logo.png"/></center>
<form class="login" name="log" ng-submit="login()" novalidate>
<div class="form-group login-form" ng-class="{'has-error' : isInvalid(log.email) ,'has-success' : isValid(log.email)}">
<input type="email" class="form-control" name="email" ng-model="user.email" required placeholder="Email">
<div class="alert alert-danger" role="alert" ng-show="isInvalid(log.email)">Enter valid email</div>
</div>
<div class="form-group login-form" ng-class="{'has-error' : isInvalid(log.password) ,'has-success' : isValid(log.password)}">
<input type="password" class="form-control" name="password" ng-model="user.password" required placeholder="Password">
<div class="alert alert-danger" role="alert" ng-show="isInvalid(log.password)">This Feild is required</div>
</div>
<div class="form-group" style="text-align:center;">
<input type="submit" class="logbnt" value="LOGIN" ng-disabled="! log.$valid" data-dismiss='modal'/>
</div>
</form>
角度:私は$ HTTPの中に閉じどのように私のコードは、モーダルになり
$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",
});
}
?
- 'dismiss'は、おそらくこの場合に行われるべきものではありません結果をチェックするために使用さ約束を拒否しますがログインは成功しました。 –
$ modalInstanceは定義されていません –
$ scope.modalInstance – Sajeetharan