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

时间:2021-09-15 19:38:54

i have a code in routing like this

我有像这样的路由代码

   .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');
                    })

                }
            })

and close button markup

并关闭按钮标记

<div class="reset_section" ng-style="reset">
            <span class="modal_close" ng-click="modalClose()">
        <i class="material-icons">close</i>

this will open the modal on page loads, but the issue is, i can't able to close the modal by calling the function modalClose(), it is showing $uibModalInstance is not defined and also i need to open one more modal in the same page. after resetting the password, there is one button to login, after clicking the login button.it need to open login popup and have to close the reset password popup.How to do it, can anyone please help me

这将打开页面加载模式,但问题是,我无法通过调用函数modalClose()关闭模态,它显示$ uibModalInstance未定义,我还需要打开另一个模态同一页。重置密码后,点击登录按钮后有一个登录按钮。需要打开登录弹出窗口,必须关闭重置密码弹出。如何做,有谁可以帮我

1 个解决方案

#1


0  

You could use $uibModalStack.dismissAll(); to dismiss all the existing modals.

你可以使用$ uibModalStack.dismissAll();解雇所有现有的模态。

In your case, You just need to add $uibModalInstance in the controller and try running it again. use $uibModalInstance.close() function.

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

#1


0  

You could use $uibModalStack.dismissAll(); to dismiss all the existing modals.

你可以使用$ uibModalStack.dismissAll();解雇所有现有的模态。

In your case, You just need to add $uibModalInstance in the controller and try running it again. use $uibModalInstance.close() function.

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