mercredi 23 décembre 2015

EmberJs "needs" in ember-2.0.1

I am trying to access from a child template to its parent data in the previous versions of emberjs this could have be done using the needs keyword:

app.RepositoriesController = Ember.Controller.extend({
    needs: "user",
    user : Ember.computed.alias("controllers.user");
 });

from what I understand with the new ember version this should be done like the following (as the needs keywords became deprecated):

app.RepositoriesController = Ember.Controller.extend({
    user: Ember.inject.controller('user')
});

but it doesn't seems to work in my html code I use the following line which is blank:

{{user.name}}

Thanks!




Aucun commentaire:

Enregistrer un commentaire