Closed xmlking closed 10 years ago
maybe you should change your login dialog pop up to not fire if one is already open, say in maybe a service that handles that.
I am doing that as workaround, in my auth controller using a scope variable to suppress login popups until previous dialog is closed. It would be nice if it is implemented in framwork level to delay subsequent 'event:auth-loginRequired' events untile e.g $stateChangeError or $stateChangeSuccess events received.
Those should be done in your app. There is no way to account for all that (ngRoute vs ui-router vs custom) in this module.
@eddiemonge is right, just ignore the messages if you are still waiting for user to submit...
Why not wait for loginConfirmed() or loginCancelled() before issuing new 'event:auth-loginRequired'?
how did you resolve this? I have the exact same scenario. If I have to add a check in service that opens the modal, how do I do that? Say my modal is called from a service like this everytime the 401 is thrown:
var modalInstance = $modal.open({
templateUrl: 'views/LoginModalTemplate.html',
controller: 'LoginModalCtrl'
});
modalInstance.result.then(function () {
// If Confirmed
authService.loginConfirmed();
}, function () {
// If cancelled
//$state.go('index');
authService.loginCancelled();
});
The above opens multiple login modals when http-auth-interceptor
catches multiple 401's from the api for 1 page load. How do I stop the other modals from opening up when one is already existing? Do I need to add a switch to the $rootscope and check in service before the modal instance opens up? An example will greatly help please ..
Thanks heaps for that @xmlking That certainly gives me an idea now on how to approach this. Thanks again for helping. I was stuck on that for a long time wondering how to resolve it. Much appreciated. :)
I am using angular UI router that supports nested views. My nested views invoke multiple REST services at same time for for a given URL .when two REST calls receive 401 error, this module is broadcasting two loginRequired events. This causes my login dialog pops up again after successful login. It would be nice if this module Wait for loginConfirmed() call before it broadcast next loginRequired event.