vendredi 28 mars 2014

Injecting controllers into controllers on initialization no longer working (canary)


Vote count:

0




I just upgraded to the latest canary version of ember and noticed my initializer that injected the currentUser controller into all controllers no longer works.


Here is the code.



Ember.Application.initializer({
name: "fetchUsers",
after: "store",

initialize: function(container, application) {

var store, controller;

application.deferReadiness();

store = container.lookup('store:main');
controller = container.lookup('controller:currentUser');

return store.find('user').then( function(users) {
var currentUser;

currentUser = users.findBy('isCurrent', true);

controller.set('content', currentUser);

application.inject('controller', 'currentUser', 'controller:currentUser');

application.advanceReadiness();
});
}
});


This works fine in the release and beta branches but I canary I get the following error.



Error: Cannot inject a `controller:current-user` on other controller(s). Register the `controller:current-user` as a different type and perform the typeInjection.


How should I go about fixing this? I would like currentUser to be a ObjectController, is this possible?



asked 41 secs ago






Aucun commentaire:

Enregistrer un commentaire