3

With the current version of the ember router, you can define a route handler like so:

App.HomeRoute = Ember.Route.extend({
  renderTemplate: function() {
    this.render('home', {into: "application", outlet: "body"});
  }
});

Older builds would allow you to disconnect a view from an outlet on the exit state of a route like this:

exit: function(router){
  router.get('applicationController').disconnectOutlet('chatroom');
}

However, as of router v2, the disconnectOutlet method no longer works (I assume because it was lumped together with the connectOutlet(s) method(s).

So how do you disconnect a view now? Are you supposed to render a blank template into the outlet?

Bill the Lizard
  • 398,270
  • 210
  • 566
  • 880
Han
  • 1,283
  • 11
  • 25

1 Answers1

5

This should actually "just work".

On exiting a route, Ember tears down the view. However, exit is no longer a public hook, and because you are not calling super, your incorrect guess about how to tear down the view is clobbering the built-in behavior!

If you remove the exit call, everything should work as you expect.

Yehuda Katz
  • 28,535
  • 12
  • 89
  • 91
  • @Yehuda In what version of Emberjs, exit is no longer a public hook. With the current master version of Emebrjs, i'm still using exit in my Routes. – ken Jan 13 '13 at 05:46
  • 1
    @ken it still **exists** but is not public. If you use it, please make sure you call super. – Yehuda Katz Jan 13 '13 at 05:58