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

[FEATURE query-params] Allow link-to helper to work without route #3410

Merged

Conversation

alexspeller
Copy link
Contributor

Someone asked in IRC and I've been meaning to implement for a while anyway, this allows:

App.Router.map(function() {
  this.route('index', {queryParams: ['page']});
});
{{#link-to page=2}}Next Page{{/link-to}}

This is useful for example in components that can be used on multiple routes (a pagination component would be a good example) that want to change the query params but don't care about the actual route that is active.

@thomasboyt
Copy link
Contributor

👍 wanting it for the exact use case you described (generic pagination)

@stefanpenner
Copy link
Member

does this also need to be behind the flag? Or does the fact that the other code is already behind the flag handle it for us?

@alexspeller
Copy link
Contributor Author

@stefanpenner good point, I put a flag in

stefanpenner added a commit that referenced this pull request Sep 26, 2013
[FEATURE query-params] Allow link-to helper to work without route
@stefanpenner stefanpenner merged commit a222bb4 into emberjs:master Sep 26, 2013
@jasonkriss
Copy link
Contributor

I'm trying to have a generic pagination component, and this is a great first step. However, it only looks up the currentRouteName, and thus will not work when a context needs to be provided. Would it be possible to have this work with dynamic routes as well? I'm not familiar enough with the router internals..

@alexspeller
Copy link
Contributor Author

@jasonkriss this will work with dynamic routes, it will use the current context.

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

Successfully merging this pull request may close these issues.

None yet

4 participants