Skip to content
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

router.urlRouter.otherwise(…) doesn't work with pushStateLocationPlugin #21

Closed
martin-kral opened this issue Jan 13, 2017 · 2 comments

Comments

@martin-kral
Copy link

Hi Marco,
first of all thank you for your work on UI Router framework.

I have two issues with new version (0.4.0) of React UI Router. Both are connected with config prop of UIRouter component:

  1. First - there is a wrong config prop example using the old router.urlRouterProvider.otherwise (I think it should be router.urlRouter.otherwise(…)).
  2. Second - otherwise setting through config prop works only with hashLocationPlugin for me. It doesn’t work with the recommended pushStateLocationPlugin plugin. This plugin redirects the app to the desired url, but nothing else happens. BUT it works correct when I set otherwise through manual bootstraping, i.e.:
const router = new UIRouterReact()
...
router.urlRouter.otherwise("/client/list")
...
router.start()
@elboman
Copy link
Member

elboman commented Jan 13, 2017

Hi Martin!

Thanks for trying out the new version and provide feedbacks 😄

You're right, urlRouterProvider is deprecated in favor of urlRouter, I will update the example asap!

The second issue is related to a bug in ui-router-core (ui-router/core#23) and should be fixed in the next version.

If you still want to use the config prop, the otherwise rule should work when using a state name instead of an url:

router.urlRouter.otherwise({ state: 'yourstatename' })

@martin-kral
Copy link
Author

Hi Marco,
good recommendation - using state name instead of url works prefect (and moreover cleaner solution then hardcoded url).
Thank you very much for quick response.

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

2 participants