vendredi 1 mai 2015

Ember "needs" ObjectController seems inaccessible

I have the following router in Ember:

  this.resource('clients', function() {
      this.route('new');
      this.route('client', { path: '/:id' }, function() {
        this.route('profile');
        this.route('sessions');
        this.route('payments');
      });   
  });

From within the clients.client.payments route I'd like to be able to access the client information from the parent controller clients.client but I'm struggling to find a way to do this. Currently from within the clients.client.payments controller I have:

needs: ['clients'],
client: computed.alias('controllers.clients'),

This works fine to connect to the array of client records but if I instead use:

needs: ['client'],
client: computed.alias('controllers.client'),

I get an error saying that it can not find the controller. I am now considering changing 'client' from a route to a resource (with the hope that this will resolve my problem) but is there really no way to achieve the results I'm looking for as-is?




Aucun commentaire:

Enregistrer un commentaire