Problem with query params with async controllers


#1

I have been using async controllers that conclude in the aftermodel of a route.

The problem is the hooks for query params end up a little screwed up. I tried shifting this to the beforeModel in an attempt to get the hooks working, but unfortunately while the initial null states update the URL, it comes in with params declared in the url doesn’t bind the properties to url and vice versa from the controller. Is there a call to rebind the query params after I load in my controller for the applicable route? example: http://jsbin.com/sisupi


#2

I wasn’t sure why you’re returning a controller in your route. If I’m missing a use case let me know, but here is what I think you were trying to achieve.

http://jsbin.com/guqeva/1/

Also, sortBy is actually a function and one you probably don’t want to override.


#3

I want to return a controller in the route so that I don’t have to load the controllers at the beginning of the application but only when it needs to. The problem is the queryParams don’t connect to the controller later, or at least it doesn’t seem to be able to.


#4

I want to return a controller in the route so that I don’t have to load the controllers at the beginning of the application but only when it needs to.

I’m not sure there is any advantage here, especially in the case of the Application controller. Are you sure this isn’t a premature optimization?

You’re doing something unconventional, so I’m not surprised there would be issues with it.

Also, when you define your controller with extend, it’s not instantiating it. The router is responsible for this in a generateController method. Are you trying to lazily load the controller AMD style? That could be your use case just not explained up front in the issue.


#5

yes in my bigger project I am using require to lazy load the controller. My application controller isn’t actually being lazy loaded but all the other routes are being lazy loaded. I then register it via this.container.register


#6

It definitely seem like an issue that will come up as Ember brings first class support for lazy loading.

I would recommend filing a bug: https://github.com/emberjs/ember.js/issues.

Edit: it seems like this is already being discussed here https://github.com/emberjs/ember.js/issues/5672