Reputation: 1499
I am developing application using AngularJs for popup i am using ngDialog. One of my requirement is.Once we close the ngDialog popup.I need to redirect the current page to home page.
My code :
ngDialog.open({
template:'<div style="margin-top:10px;" >Please try after some time.</div>',
plain:true,
closeByEscape : false,
closeByDocument : false
});
Is it possible?
Upvotes: 0
Views: 1037
Reputation: 1216
Hei, you can try to use the preCloseCallback in order to redirect to your desired page (home page). For this you'll need $window as injection and you can use it like this :
preCloseCallback: function(value) {
var url = "#/home" // or whatever the route is
$window.location = url
return true
}
Hope it'll help. Best!
Upvotes: 3
Reputation: 331
var dialog = ngDialog.open({
template: 'templateId'
});
dialog.closePromise.then(function (data) {
window.location.replace("http://stackoverflow.com");
});
Upvotes: 0