簡體   English   中英

關閉引導模式彈出窗口時的方法調用

[英]Method call while closing a bootstrap modal popup

我試圖在關閉模式彈出窗口時重定向到一個頁面。 但事實並非如此。

我試圖通過使用重定向到一個頁面

state.go()或通過location.path()

這是 angular 中的確認彈出代碼:

function modalMessage($rootScope,result) {
    $rootScope.FinalMessage = result.finalMessage;
    $rootScope.ReasonOrTransKey = result.ReasonOrTransKey;
    $rootScope.ConfirmationMessage = result.ConfirmationMessage;

    //Finds element with attribute iConfirmationModal
    angular.element("#iConfirmationModal").modal();
}

當用戶單擊 close() 按鈕時,我想放置重定向代碼。

在此處輸入圖片說明

由於 jqLit​​e 不支持modal方法,您應該使用$而不是angular.element

普朗克

function modalMessage($rootScope,result) {
     $rootScope.FinalMessage = result.finalMessage;
     $rootScope.ReasonOrTransKey = result.ReasonOrTransKey;
     $rootScope.ConfirmationMessage = result.ConfirmationMessage;

     //Finds element with attribute iConfirmationModal
     $("#iConfirmationModal").modal();
     $("#iConfirmationModal").on('hidden', function(){
        $timeout(function(){
            $state.go(...)
        })
     })
}

當模態完成對用戶隱藏時會觸發此事件(將等待 css 轉換完成)​​。

angular.element("#iConfirmationModal").on('hidden', function () {
  // do something…
})

http://getbootstrap.com/2.3.2/javascript.html#modals

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM