mercredi 27 mai 2015

Ember accessing a different controller from a route

I want to access the applicationController from a different route (issue), inside afterModel.

The main goal is to change the background of the application once the promise model is resolved.

This is my issue.js :

import Ember from 'ember';

export default Ember.Route.extend({

  needs: ['application'],
  model: function(params) {
    [... some code ...]
  },
  afterModel: function(model, transition) {
    model.issue.then(function(resolvedIssue) {

      // I'm looking to access the controller here
      var theOtherController = this.get('controllers.application');

      return resolvedIssue;
    });

  }

});

I've tried several combinations, without success. When I try to log stuff in the console, I get a try/catch error message.

What is the proper way to do it?




Aucun commentaire:

Enregistrer un commentaire