With latest Ember, the following simple ContainerView causes the error:
DEPRECATION: Using the defaultContainer is no longer supported. [defaultContainer#
That deprecation message reference this gist, if you look the migration paths: (WIP) section, it have the following text:
if you are creating views outside the context of a parentView (this may not be recommended, but it is happening) you will want to make sure to instantiate your view via the container itself.
this.container.lookup('view:apple')
// will provide a instance of apple view.
So you need to update your code to use the container instead of App.FooView.create()
.
App.IndexController = Ember.Controller.extend({
show: function() {
var v = this.container.lookup('view:foo');
v.appendTo(App.rootElement);
}
});
Depending of your version, you will receive a new warning message:
DEPRECATION: Action handlers implemented directly on controllers are deprecated in favor of action handlers on an
actions
object (show on )
In that case put your action in a actions
object:
App.IndexController = Ember.Controller.extend({
actions: {
show: function() {
var v = this.container.lookup('view:foo');
v.appendTo(App.rootElement);
}
}
});
This is a updated jsbin using the lastest ember version without warnings http://jsbin.com/uqawux/4/edit