emberjs/ember.js — pull request #2310 by robharper (2013-03-20 17:28:07+00:00)
Title: Ability to specify the view class used by the outlet Handlebars helper

Currently, the ```{{outlet}}``` Handlebars helper always creates an "OutletView" (Metamorph extension of ContainerView) that manages the views rendered into the outlet. While this handles simple view replacement on navigation (through connectOutlet class in routes, for example) it makes it difficult to animate between views since the outgoing view is immediately destroyed upon connecting the incoming view.

This change allows the view class used by the outlet to be set. A simple use case is animating between views rendered into an outlet on a route change. E.g. sliding (jQuery mobile-style) between master-detail views. The pseudocode for a naive replacement outlet container view for this would be something like:

``` handlebars
{{outlet viewClass=App.SlideContainer}}
```

``` javascript
App.SlideContainer = Ember.ContainerView.extend({
_currentViewWillChange: Ember.beforeObserver(function() {
// Hold on to old view
}, 'currentView'),

_currentViewDidChange: Ember.observer(function() {
// Append new current view to container
// Slide all views in container to the left
// When animation is complete, destroy old view
}, 'currentView')
});
```

PR #1034 addressed a similar issue but in @c0urg3tt3's case the problem could be easily solved by specifying ```tagName``` and other general view properties in the outlet helper call (since it's an extension of the view helper). The problem being addressed here involves the need for custom view lifecycle handling code that requires replacing, not adding bindings to a hardcoded ```OutletView``` class.

PR #1046 appears to be somewhat of a duplicate of #1034. @wycats' [proposed solution](https://github.com/emberjs/ember.js/pull/1046#issuecomment-6497862) does allow a custom class to be used but no longer is a sufficient replacement for the role of an outlet since the base view helper does not find and set the ```outletSource``` property of the parent view.