Skip to content

Instantly share code, notes, and snippets.

@mikegrassotti
Created June 5, 2014 21:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mikegrassotti/9710c7f63881fb868359 to your computer and use it in GitHub Desktop.
Save mikegrassotti/9710c7f63881fb868359 to your computer and use it in GitHub Desktop.
Ember.js Query Params: Observe multiple query params then run a function once when one or more params are changed
var expensiveQuery = function(message) {
console.log('*** EXPENSIVE QUERY ***');
console.log('start:', this.get('start'));
console.log('end:', this.get('end'));
};
export default Ember.Controller.extend({
queryParams: ['start', 'end'],
start: null,
end: null,
paramsDidChange: function() {
Ember.run.once(this, expensiveQuery);
}.observes('start', 'end'),
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment