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

feat(router): add params to navigate() #539

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

jwx
Copy link
Member

@jwx jwx commented Oct 18, 2017

Adds a params parameter to the navigate() function, so that

router.navigate('#/main/:id/details', undefined, { id: 123, name: "onetwothree" })

results in navigation to

'#/main/123/details?name=onetwothree'

In other words, found named params are placed in the url, not found ones are added to the querystring.

@jwx
Copy link
Member Author

jwx commented Oct 18, 2017

Is this within the scope of the router? (At least it's a quite small addition.) @EisenbergEffect @bryanrsmith @davismj

@davismj
Copy link
Member

davismj commented Oct 18, 2017

Is there anything this solves that doesn't currently work with router.navigateToRoute?

router.navigateToRoute('main-details', { id: 123, name: 'onetwothree' });

@jwx
Copy link
Member Author

jwx commented Oct 18, 2017

@davismj router.navigate doesn't require route configuration.

@davismj
Copy link
Member

davismj commented Oct 25, 2017

@jwx Why would you want to navigate to a route that isn't configured?

@davismj
Copy link
Member

davismj commented Oct 30, 2017

I'm not going to close this. I see a great deal of value in having a utility function that generates a URL with query string parameters as a first-class citizen in Aurelia. I'm just not sure it goes here. It might!

@bigopon
Copy link
Member

bigopon commented Jun 3, 2018

I think this feature is desirable. Currently I don't see how navigateToRoute of child Router can help navigate to routes in different route branches, so one may end up rolling their own, like the feature this PR adds.

Adds a `params` to the `navigate()` function, so that
```
router.navigate('#/main/:id/details', undefined, { id: 123, name: "onetwothree" })
```
results in navigation to
```
'#/main/123/details?name=onetwothree'
```

In other words, found named params are placed in the url, not found ones are added to the querystring.
@jwx
Copy link
Member Author

jwx commented Oct 5, 2018

@davismj Any chance of getting this merged?

@CasiOo
Copy link

CasiOo commented Oct 6, 2018

@bigopon is right. This PR will be very useful when dealing with navigation with child routes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants