I am trying to redirect to a page while closing a modal popup. But that's not happening.
I am trying to redirect to a page either by using
state.go()
or by location.path()
.
Here is the confirmation pop - up code in 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();
}
When the user clicks on the close() button I want put my redirect code.
since the jqLite does not support modal
method, you should use $
instead of 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(...)
})
})
}
This event is fired when the modal has finished being hidden from the user (will wait for css transitions to complete).
angular.element("#iConfirmationModal").on('hidden', function () {
// do something…
})
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.