Skip to content

Allow managing state transition asynchronously. #1139

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

Closed
petrukhnov opened this issue Jun 10, 2014 · 2 comments
Closed

Allow managing state transition asynchronously. #1139

petrukhnov opened this issue Jun 10, 2014 · 2 comments

Comments

@petrukhnov
Copy link

Idea is similar to one of the comments from #618

pause()
resume()
halt()

E.g. now I adding service that watch forms, and show modal to user when user try to navigate away. Modal is async, so i need to do some tinkering. Can't say if it is correct solution, but it seems it works now.

var initialTransition = true;
$rootScope.$on('$stateChangeStart', ... {
  if (!initialTransition) {
    return;
  }
  some async call().then(function() {
    if(stayOnCurrentState) {
      return;
    }
    initialTransition = false;
    $state.transitionTo(to, toParams);
    initialTransition = true;
  });
   event.preventDefault();
});

One way to solve it, could be some method that do these. Another option would be to add new option 'skipStart', that will allow to skip only '$stateChangeStart' (similar to 'notify' option).

@chopachom
Copy link

+1

@eddiemonge
Copy link
Contributor

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

3 participants