Reputation: 5021
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.
Upvotes: 2
Views: 90
Reputation: 2324
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(...)
})
})
}
Upvotes: 2
Reputation: 403
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…
})
http://getbootstrap.com/2.3.2/javascript.html#modals
Upvotes: 0