When accessing another controller from withing a controller, it is detached from template/view


#1

Hi,

I am having problems with the following scenario: I have a controller that needs to invoke an action in other controller. When it sends the action, the other controller receives it but it has no effect on its view/template as intended. I set the model of that controller manually with set('model', ...) before invoking the action. Is it possible to achieve what I want?

App.SomeController = Ember.ObjectController.extend({
	needs: ['other_controller'],

	someAction: function(){
		var controller = this.get('controllers.other_controller');
		controller.set('model', someModel);
		controller.send('someOtherAction')M
	}
}

App.OtherController = Ember.ObjectController.extend({
	someOtherAction: function(){
		// this action is invoked but this controller instance is not actually 
                // attached to any template, so modifying its properties does not
                // have the intended effect
	}
}

```

#2

It might make sense to attach that state change information on a model that is shared between the two.

eg

someAction: function(){
  this.set('model.didAction', true)
}

and then when you land on the other controller

your template can have

{{#if model.didAction }}
{{else}}
{{/if}}