Skip to content

Commit

Permalink
Merge branch 'master' of github.com:alexspeller/ember-query
Browse files Browse the repository at this point in the history
  • Loading branch information
A. Speller committed Mar 25, 2013
2 parents a4b6bab + 18c04aa commit 5f235ba
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ A querystring library for Ember.js. Tested with 1.0.0-RC.1

## What is it?

A library enabling url query parameters to be used in ember applications. This features is slated to be included in Ember.js 1.1, however I needed it now.
A library enabling url query parameters to be used in ember applications. This feature is slated to be included in Ember.js 1.1, however I needed it now.

## Status

Expand Down Expand Up @@ -48,8 +48,16 @@ MyApp.FooRoute = Em.Route.extend({

// setupController is only called when params change and this route
// is the current child route (not a parent of the current state)
// Query params are passed as the third argument to this hook now
setupController: function(controller, context, params) {
controller.set('page', params.page);
},

// query params are passed as the second argument to the model hook
// in case you need to use them to affect the model
model: function(params, queryParams) {
page = queryParams.page || 1;
return MyApp.Things.find({page: page});
}
});

Expand Down Expand Up @@ -124,4 +132,4 @@ MyApp.BarController = Em.Controller.extend({

These helpers will transition appropriately and run the `deserializeParams` hook in all routes in the current state tree, which should apply the values to controllers appropriately.

Right now, the implementation is pretty hacky but it seems to work OK and also seems to make sense conceptually. I'd be really interested in any feedback on the general idea of how it works, along with general bug reports and patches.
Right now, the implementation is pretty hacky but it seems to work OK and also seems to make sense conceptually. I'd be really interested in any feedback on the general idea of how it works, along with general bug reports and patches.

0 comments on commit 5f235ba

Please sign in to comment.