This is not directly possible between views. Instead you should implement an indirect communication with the help of your controllers. Consider the following fictious example of two views and their associated controllers:
You should send an action from FirstView to FirstController (which needs SecondController). The Controller then forwards the action to SecondController. SecondController does whatever it needs to do (e.g. sets a property) and thus informs SecondView about it.
Update: Example
Plz note: I am assuming that you need to send to an object from FirstView
to the SecondView
. If you don't need an argument for your event, you can just omit it.
View:
App.FirstView = Ember.View.extend({
submit : function(){
//do the view part of your logic
var object = //do whatever you may need
this.get("controller").send("actionInController", object); //you do not have to send a object, if you do not need to
}
});
Controller:
App.FirstController = Em.ObjectController.extend({
needs : ['second'],
actions : {
submitInController: function(object) {
// do the controller part of your logic
this.get("controllers.second").methodOfSecond(object);
}
},
});
App.SecondController = Em.ObjectController.extend({
someProperty : null,
methodOfSecond: function(object) {
// set whatever property so that the second view gets informed
this.set("someProperty", object);
}
});