mercredi 31 décembre 2014

Ember component cannot use access controller property via "needs"

I'm trying to change a controller's property from a component as follows(JSBIN example http://jsbin.com/gevuhu):



App.CategoryManagerController = Ember.Controller.extend({
selectedCategory: null,
});

App.BlogPostComponent = Ember.Component.extend({
needs: ['categoryManager'],
selectedCategory: Ember.computed.alias('controllers.categoryManager.selectedCategory'),
actions:{
selectedCategory: function (){
this.set('selectedCategory',1);
}
}
});


but getting the error Property set failed: object in path "controllers.categoryManager" could not be found or was destroyed.


Is it that we cannot use "needs" in components ?





Aucun commentaire:

Enregistrer un commentaire