0

我有一個代碼,在路由這樣關閉,打開特定的模式在頁面加載角UI引導

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

       } 
      }) 

和關閉按鈕標記

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

這將打開頁面加載模態,但問題是,我無法通過調用函數modalClose()來關閉模式,它顯示$uibModalInstance is not defined並且我還需要在同一頁面中再打開一個模式。重置密碼後,有一個按鈕登錄,點擊登錄按鈕後,需要打開登錄彈出窗口,並且必須關閉重置密碼彈出窗口。如何操作,任何人都可以請幫我

回答

0

您可以使用$uibModalStack.dismissAll();解散所有現有的模態。

就你而言,你只需要在控制器中添加$uibModalInstance,然後再次運行它。使用$uibModalInstance.close()功能。