[英]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() 按鈕時,我想放置重定向代碼。
由於 jqLite 不支持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…
})
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.