Skip to content

provide resolved dependencies to the $stateChangeSuccess event #229

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
wants to merge 1 commit into from

Conversation

cburgdorf
Copy link

This commit adds a property locals to the state parameters of the $stateChangeSuccess event similar to the locals property for the parameters on the $routeChangeSuccess event on angular core.

Fixes #228

@nateabele
Copy link
Contributor

We're currently working on providing these events with much more data (which will include resolved locals), so I don't think we want to change the API twice.

this commit adds toLocals and fromLocals parameters
to the $stateChangeSuccess event similar
to the "locals" property for the parameters on the
$routeChangeSuccess event on angular core.
@cburgdorf
Copy link
Author

Hey @nateabele I update this ancient PR to work against latest master again. It's probably not ready for merging but I didn't want to put too much effort into it before I received any positive signal from you.

I think the claim is still valid: the vanilla angular $routeChangeSuccess event exposes the resolved locals (the stuff from the route resolve block) whereas the $stateChangeSuccess from the ui-router project does not.

I'd really like the ui-router to behave more like Angulars built in routing in this case and I guess other might run into this issue, too.

With this PR I'm exposing a bit too much I guess and it's also missing tests so I completely understand it's not ready for merge yet but if you agree with me that we want this and leave some advice on the implementation, I'd be happy to work on that.

@timkindberg
Copy link
Contributor

@cburgdorf so the plan is to implement a $transition service that holds data for any currently running transition (or null if there isn't one). This would then be injected into the various event handlers instead of the many params. The params would be moved onto the $transition service as properties. I'm not sure on the status of this work though, so @nateabele would have to tell you if its worth it for you to workon.

@nateabele
Copy link
Contributor

Yeah, please follow #1257 for the implementation of this, as we're taking a much cleaner approach to solve the problem.

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

Successfully merging this pull request may close these issues.

$stateChangeSuccess should expose locals
4 participants