在angular-ui bootstrap中关闭,打开页面上的特定模态

时间:2016-08-05 11:22:59

标签: javascript angularjs modal-dialog angular-ui-router angular-ui

我有像这样的路由代码

tag

和关闭按钮标记

   .state('resetPassword', {
                url: '/home/reset_password',
                templateUrl: 'home/home.html',
                controller: 'HomeController',
                controllerAs: 'vm',
                data: {
                    requireLogin: false /* This is what tells it to require authentication */
                },
                onEnter: function($state, $uibModal) {
                     var mymodal=$uibModal.open({
                        backdrop: true,
                        templateUrl: 'login/resetpassword.html',

                    }).result.finally(function() {
                        $state.go('home');
                    })

                }
            })

这将打开页面加载模式,但问题是,我无法通过调用函数modalClose()来关闭模态,它显示<div class="reset_section" ng-style="reset"> <span class="modal_close" ng-click="modalClose()"> <i class="material-icons">close</i> 并且我还需要打开同一页面中的另一个模态。重置密码后,点击登录按钮后有一个登录按钮。需要打开登录弹出窗口,必须关闭弹出的重置密码。如何做,有人可以帮帮我

1 个答案:

答案 0 :(得分:0)

您可以使用$uibModalStack.dismissAll();来解除所有现有模态。

在您的情况下,您只需在控制器中添加$uibModalInstance并尝试再次运行它。使用$uibModalInstance.close()函数。