There’s one option that I’m using not mentioned above:
Use route#render method
This gives you the advantage of Option 1 of being able to optionally perform operations before rendering, and easily customize the modal based on the specific case. The advantage of Option 2 of having the self-contained thing. The advantage of Option 3 by only displaying when needed.
App.ApplicationRoute = Ember.Route.extend({
events: {
showModal: function(options) {
this.controllerFor('modal').setProperties(options);
this.render('modal', {
into: 'application',
outlet: 'modal'
});
},
dimissModal: function() {
this.controllerFor('modal').reset();
this.clearOutlet('application', 'modal');
}
},
clearOutlet: function(container, outlet) {
parentView = this.router._lookupActiveView(container);
parentView.disconnectOutlet(outlet);
}
});