Skip to content

Commit

Permalink
[DOC release] Extend Route.paramsFor documentation
Browse files Browse the repository at this point in the history
Improve documentation on `Route.paramsFor`.

Fixes emberjs#13771
  • Loading branch information
Serabe authored and webark committed Oct 6, 2016
1 parent ff35c22 commit 1506d79
Showing 1 changed file with 34 additions and 2 deletions.
36 changes: 34 additions & 2 deletions packages/ember-routing/lib/system/route.js
Original file line number Diff line number Diff line change
Expand Up @@ -344,11 +344,43 @@ let Route = EmberObject.extend(ActionHandler, Evented, {
mergedProperties: ['queryParams'],

/**
Retrieves parameters, for current route using the state.params
variable and getQueryParamsFor, using the supplied routeName.
Returns a hash containing the parameters of an ancestor route.
Example
```javascript
App.Router.map(function() {
this.route('member', { path: ':name' }, function() {
this.route('interest', { path: ':interest' });
});
});
App.MemberRoute = Ember.Route.extend({
queryParams: {
memberQp: { refreshModel: true }
}
});
App.MemberInterestRoute = Ember.Route.extend({
queryParams: {
interestQp: { refreshModel: true }
},
model() {
return this.paramsFor('member');
}
});
```
If we visit `/turing/maths?memberQp=member&interestQp=interest` the model for
the `member.interest` route is hash with:
* `name`: `turing`
* `memberQp`: `member`
@method paramsFor
@param {String} name
@return {Object} hash containing the parameters of the route `name`
@public
*/
paramsFor(name) {
Expand Down

0 comments on commit 1506d79

Please sign in to comment.