Ember queryParams default value has to be static
Today I learned that Ember queryParams do not work with computed properties. They intend to be static values and here is an issue discussion about that.
So this code will not work properly:
export default Ember.Controller.extend({
queryParams: ['start'],
start: new Date().getFullYear() + '-' + (new Date().getMonth() + 1) + '-' + new Date().getDate();
});
export default Ember.Route.extend({
queryParams: {
start: { refreshModel: true }
},
model(params) {
console.log('start', params.start);
}
});
In this example the default value is cached and if you try to change it manually, or use a computed property with volatile
, you'll see a delegate is not a function
error message.