-
Notifications
You must be signed in to change notification settings - Fork 3k
Pause transition between views, continue on function call or event broadcast #2233
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
Comments
We are having a similar issue in our project and the way we got around it was by doing event.preventDefault() in a stateChangeStart and then doing $state.go(toState, toParams, options)(since options was added to stateChangeStart not long ago). But this causes other issues such as the function that invoked $state.go might me expecting the promise to be resolved when it has been rejected to be invoked later. I though of a mechanism to do the deferring of stateChange: Add a defer() method to the params in stateChangeStart that returns a deferred object when called. If you are happy with the approach I can start working on a PR. We need this functionality ASAP in our project since is blocking us so I need to know if this is something that can be added to ui-router or we need to find a different approach. |
+1 waywed, I could use this too :) |
+1 waywed, I need it for my project too! |
@wawyed that sounds like a great solution, that I would love to look at. |
@gildebrand Great, all we need is @christopherthielen or @nateabele opinion. |
Hey folks. This is unlikely to pass PR because state events are deprecated in 1.0. 1.0 hooks will offer great improvements for inserting custom promises into the transition. Note, however, that controllers for views are essentially invoked after the transition is complete as is the case in 0.2.15 |
I understand, when can we expect to get 1.0 released? |
when this list is finished, an beta release can be made |
Closing due to chris' reasoning above. Please try out feature-1.0 to see if it will work for you. |
Right now when using ui-router together with ng-animate, the process of switching views goes something like this:
This might not be completely accurate, since I'm new to this part of Angular (please tell me if I got something wrong).
I would like to have an option to add a "pause" option between step 3 and 4 above. But why?
A new view with new DOM was just introduced to the document, and it might (or possibly) not be finished with all the DOM changes if there is data that needs to be bound. This causes that when step 4 is reached, DOM changes are still taking place. And to animate an element while DOM changes is still taking place in that element makes the animation quite choppy, causing a non-optimal experience for the end user.
So, can I somehow pause the whole transition process between step 3 and 4 and then continue the transition whenever an event is broadcasted, or a function is called?
The text was updated successfully, but these errors were encountered: