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

Query params resolves as undefined #17

Closed
FranciscoGarciaPilar opened this issue Dec 13, 2016 · 3 comments
Closed

Query params resolves as undefined #17

FranciscoGarciaPilar opened this issue Dec 13, 2016 · 3 comments

Comments

@FranciscoGarciaPilar
Copy link

FranciscoGarciaPilar commented Dec 13, 2016

I have this state definition:
const routerState = { name: 'router', url: '/sign-router?event', component: SignRouter }; const router = new UIRouterReact(); router.urlRouterProvider.otherwise('/'); router.stateRegistry.register(routerState); router.start();

event should be a state param defined in the url as a query param but trying for example http://localhost:8080/#/sign-router?event=ttl_expired the state component get the following values in the props.resolves:
resolves: { $stateParams: { #: null, event: undefined },... }

Am I missing any state param configuration for query params? If use the /route/:param notation works but not with query params notation.

@christopherthielen
Copy link
Member

Am I missing any state param configuration for query params?

Nope, the URL with the param declared should be enough. I'll see if I can reproduce.

@christopherthielen
Copy link
Member

christopherthielen commented Dec 15, 2016

if you clone the ui-router-react repository, there is a simple example app. The sample app has a home state with a query parameter:

let home = { name: 'home', component: Home, url: '/home?foo' };

I added <h1>foo: {this.props.resolves.$stateParams.foo}</h1> to the Home component. Then ran the app (npm run dev) and typed in the url /home?foo=bar. The param value shows up in the component.

screen shot 2016-12-15 at 11 09 15 am

screen shot 2016-12-15 at 11 09 27 am

@eddiemonge
Copy link
Member

As this issue is almost 2 years old, it is being closed. If you feel like the problem reported is still valid, please add a comment saying it is still affecting you. We will reevaluate it and if it is valid we will reopen it.

Thank you for supporting and contributing to the project.

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

3 participants