Reputation: 263
In my ember 1.9.1 (EAK) app, am using queryParams to navigate between pages and for updating corresponding url on clicking corresponding button. The view get rendered if I click the button for first time, but if I refresh the page, am getting "Cannot read property send of undefined" In my approute.js I've something like,
queryParams: {category: {refreshModel:true}},
------model----
actions: { queryParamsDidChange: function(){
var self = this;
console.log("CONTROLLER " + this.controller);
self.controller.send('resetListObj'); // No I18N
self.controller.send('resetPageObj'); // No I18N
self.refresh();
} }
My appcontroller.js has something like
queryParams: ['category'], // No I18N
category: 'all', // No I18N
My controller becomes undefined if I refresh the page.
Upvotes: 0
Views: 2377
Reputation: 116
This is because the 'queryParamsDidChange' action in the route is fired before the controller itself is instantiated. You will have to defer the functions being called on the controller by manipulating the run loop using functions like 'Ember.run.next' or 'Ember.run.later'.
Upvotes: 1