Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Close callback being called multiple times when location changes #258

Closed
DougKeller opened this issue Jan 17, 2019 · 0 comments
Closed

Close callback being called multiple times when location changes #258

DougKeller opened this issue Jan 17, 2019 · 0 comments

Comments

@DougKeller
Copy link
Contributor

DougKeller commented Jan 17, 2019

TL;DR: If the location changes while waiting on an async operation before closing a modal, the cleanUpClose function is invoked multiple times, resulting in an exception:

TypeError: Cannot read property 'resolve' of null (line 206 of angular-modal-service.js)

Steps to Reproduce

  1. perform an async operation within a modal's controller, closing the modal once it's complete
// ModalController
$http.post('something').then(() => {
  close();
});
  1. While the request is running, go to a different url
$location.path('/some-other-url');
  • $locationChangeSuccess is broadcasted, which closes the modal
  1. async operation finishes
  • $http.post promise is resolved, causing close to be called
  • Because cleanUpClose was called already and set everything to null, the above exception is raised
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant