samedi 18 avril 2015

How to use non singleton controllers that require a model (from the route)?

I have a simple app that returns a model from a child (nested) route. When my controller is a singleton (the default in ember today) it works fine. The child model hook is call and a model is bound to the controller/view/template as you'd expect.


The trick is that when I flip the singleton bit my model is suddenly dead /undefined from the very start.


The branch above has an initializer (like so)



import Wat from "kanban/controllers/todos/todo";

export function initialize(container, application) {
application.register('controller:todos/todo', Wat, {singleton: true });
}


If you turn this from true to false the tests break /the child route never gets a model for that controller.


Is this supported to in ember 1.10+ and if so what am I doing wrong here?


Here is the branch on github for more context (it's a simple example app to show this is or is not supported -hope the ember-cli app is minimal)


http://ift.tt/1zu3j1T


Aucun commentaire:

Enregistrer un commentaire