Created
June 5, 2014 21:01
-
-
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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