Skip to content

Reduce Providers Needed for States #184

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
timkindberg opened this issue Jun 14, 2013 · 8 comments
Closed

Reduce Providers Needed for States #184

timkindberg opened this issue Jun 14, 2013 · 8 comments

Comments

@timkindberg
Copy link
Contributor

Goes along with idea of recuuding complexity, see #174.

Too many providers! stateProvider, urlProvider, urlRouteProvider, routeProvider, abcProvider, xyzProvider and whatever other providers we make people use. It's madness! I feel like we shouldn't have to use anything other than stateProvider, even if it means adding proxy methods onto stateProvider that just call methods on other providers.

Is there anything wrong with adding .when(), .otherwise(), .redirect(), etc straight to stateProvider?

@nateabele
Copy link
Contributor

It would be an impedance mismatch. The focal point of the state machine is states, and those methods all have to do with URLs.

What I will say is that all good state machines provide opportunities that allow easy recovery from situations which would otherwise leave the state machine in an inconsistent state.

That being said, I only ever use stateProvider, and I've never had a problem with only using state() and transitionTo().

@laurelnaiad
Copy link

$stateProvider/$state are enough for me with the addition of aliases and "otherwise", which is what I did for detour.

@timkindberg
Copy link
Contributor Author

Alright. I'll def defer to your two opinions on this since you've both used it more than me. This is probably a confusion that stems from the various providers used in the example, which we all know needs to be redone as a more real world example. Just need one of us to find the time :)

@laurelnaiad
Copy link

I think this issue is so close to #185 that we might as well pick one of them and concentrate our focus there -- so see #185 for my response... but here's a hint: I'll raise you one deferral and defer to @ksperling!

@ksperling
Copy link
Contributor

On some of these things it would be really good to get some feedback from people who've written reasonably large apps with ui-router in anger...

I generally prefer 2 clean APIs that are orthogonal to one mixed thing that appears convenient but isn't very clear on what it does. It think with the '' -> '/' fix and maybe alias URLs there shouldn't be much reason to use $urlRouterProvider directly in most cases.

@laurelnaiad
Copy link

On some of these things it would be really good to get some feedback from people who've written reasonably large apps with ui-router in anger...

I've tried writing code in anger before and it feels good at first but never seems ti work properly the day after!!! ;)

@nateabele
Copy link
Contributor

I'm guessing we can close this? If an app isn't using the compatibility shim, they only ever need two providers, which seems like a perfectly appropriate thing to me.

@timkindberg
Copy link
Contributor Author

Sure, I think the docs have been enhanced since then as well and we've gotten almost no questions on this.

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

4 participants