简体   繁体   English

在angular-ui引导程序中关闭,打开页面加载时的特定模式

[英]Close ,opened particular modal on page loads in angular-ui bootstrap

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. 这将在页面加载时打开模式,但是问题是,我无法通过调用函数modalClose()来关闭模式,这表明$uibModalInstance is not defined ,而且我还需要在页面中打开一个模式同一页。 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 重置密码后,只有一个按钮可以登录,单击登录按钮后,需要打开登录弹出窗口,必须关闭重置密码弹出窗口。如何操作,任何人都可以帮助我

You could use $uibModalStack.dismissAll(); 您可以使用$uibModalStack.dismissAll(); to dismiss all the existing modals. 消除所有现有的模态。

In your case, You just need to add $uibModalInstance in the controller and try running it again. 对于您的情况,您只需要在控制器中添加$uibModalInstance并尝试再次运行它。 use $uibModalInstance.close() function. 使用$uibModalInstance.close()函数。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM