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

Default state #89

Closed
stasgrom opened this issue Apr 16, 2013 · 6 comments
Closed

Default state #89

stasgrom opened this issue Apr 16, 2013 · 6 comments

Comments

@stasgrom
Copy link

Hi,

in angular.js there's a possibility to configure the default route (using $routeProvider.otherwise() API). Is there anything in ui-route that can be used to achieve similar functionality? I need this to ensure the customer that opens the URL without the path part will automatically be redirected to a default state.

Thanks.

@ksperling
Copy link
Contributor

$urlRouterProvider.otherwise('/') // or whatever the URL of your default state is (the state needs to be declared separately)

@stasgrom
Copy link
Author

Thanks!

@brianconnoly
Copy link

Can you describe this to me please?
Should I add new argument ($urlRouterProvider) to my .config function?

@timkindberg
Copy link
Contributor

Yes you'll need to inject $urlRouterProvider into your config function along with $stateProvider. Use $sP to set up all your states and then $uRP to set up a single otherwise.

$urlRouterProvider.otherwise("/"); // this will send any non-valid url back to "/'
or
$urlRouterProvider.otherwise("/myhomeurl"); // this will send any non-valid url back to "/myhomeurl', assuming thats the entry point of your app

@bkuhl
Copy link

bkuhl commented Jun 19, 2013

This isn't exactly working for me.

http://stackoverflow.com/questions/17200231/how-to-set-default-url-route

@laurelnaiad
Copy link

@bkuhl, I responded on SO -- I think the issue is more with angular than
ui-router.

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

6 participants