Skip to content

Default stateParam values? #436

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
braco opened this issue Sep 17, 2013 · 4 comments
Closed

Default stateParam values? #436

braco opened this issue Sep 17, 2013 · 4 comments

Comments

@braco
Copy link

braco commented Sep 17, 2013

I have

/foo/:bar

and I would like :bar to default to "baz" when nothing is provided.

what's the best way to do this?

@timkindberg
Copy link
Contributor

Well you could use $urlRouterProvider.

$urlRouterProvider.when("/foo", "/foo/baz");
$urlRouterProvider.when("/foo/", "/foo/baz");

@eahutchins
Copy link

You could also use $urlRouterProvider.otherwise(function($injector, $location) {...}) if you need something a bit more programmatic.

@nateabele
Copy link
Contributor

This will be possible when typed parameters are implemented. Keep tabs on #454.

@timkindberg
Copy link
Contributor

I think we can close this with 2 possible solutions and 1 upcoming.

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