admin管理员组文章数量:1294124
I'm using bootstrap 3 modal as a dialog confirmation in my AngularJS App. When i hide the modal and redirect the backdrop of the modal still remains.
$scope.delete = function () {
DataService.delete()
.then(function () {
$("#delete").modal("hide");
$location.path("/");
});
}
I have tried using the callback on hidden
$("#delete").on('hidden.bs.modal', function () {
$location.path("/");
}
But the delay in this is a lot.
Is there a better way to do this?
I'm using bootstrap 3 modal as a dialog confirmation in my AngularJS App. When i hide the modal and redirect the backdrop of the modal still remains.
$scope.delete = function () {
DataService.delete()
.then(function () {
$("#delete").modal("hide");
$location.path("/");
});
}
I have tried using the callback on hidden
$("#delete").on('hidden.bs.modal', function () {
$location.path("/");
}
But the delay in this is a lot.
Is there a better way to do this?
Share asked Oct 14, 2013 at 8:49 YashvitYashvit 2,4163 gold badges27 silver badges33 bronze badges 1- You can also take a look at the angular directives for bootstrap made by the angular-ui team angular-ui.github.io/bootstrap – zethus Commented Oct 14, 2013 at 19:45
1 Answer
Reset to default 11But the delay in this is a lot.
You are probably forgetting to call $scope.$apply()
. Try changing it to the following (if the delay is the only problem) and the delay should be normal:
$("#delete").on('hidden.bs.modal', function () {
$location.path("/");
$scope.$apply();
});
All code that is called outside Angular (in this case from jQuery event) that interacts with Angular should call $apply()
.
本文标签: javascriptHide Bootstrap 3 Modal amp AngularJS redirect (locationpath)Stack Overflow
版权声明:本文标题:javascript - Hide Bootstrap 3 Modal & AngularJS redirect ($location.path) - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741585578a2386828.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论