-
Notifications
You must be signed in to change notification settings - Fork 3k
Added a .back method to ui-router, fixes #92 #861
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
Conversation
I really think history tracking is out of scope for |
It's unfortunately not a $location concern as, $location is for when url changes are occuring. In this instance we are actually wanting the feature of a $state change, as if we do not want to update the url for various reasons, a $state history is the best way round it without a hack on the state change event. Also, there is only one thing happening in this PR. The creation of a .back method and the necessary setup of caching of the previous state and params. The rest is document updating as requested in the developer guidelines stated. |
I'm not sure I understand. It looks like the docs were fully regenerated. |
The only changes I have made are in state.js and stateSpec.js for the unit tests. All of the rest was generated when I ran grunt dist to produce the correct documentation from my JS Doc for the new method I have created. |
Yeah, we're removing the generated stuff from the repo. |
OK, I was just following what looked like the normal practice. Is the PR all good now you have more information? |
I'm a bit worried devs will think this method can go back beyond just a single state. Do you think its okay that it only can go back one time? |
I think it's perfectly good to only go back one state, this is the functionality people were asking for, else you would just use the go function as there would be more routes usually that could take you more than one link away. I will squash the commit and remove generated docs now. |
Adds $state.previous and $state.previousParams. Implements $state.back method which wraps $state.transitionTo and can take an options object which is passed through. $state.previous and $state.previousParams are only updated when the transition completes. Added unit tests for .back method()
@timkindberg Commits have been squashed along with removing documentation |
Sorry, I still really don't think this is a good solution. Three reasons:
If you're interested in rolling your own separate |
Adds $state.previous and $state.previousParams. Implements $state.back method
which wraps $state.transitionTo and can take an options object which is passed
through.
$state.previous and $state.previousParams are only updated when the transition
completes.