那過時消息引用此gist,如果你看的遷移路徑:(WIP)部分,它有如下文字:
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.
所以你需要更新你的代碼來使用容器而不是App.FooView.create()
。
App.IndexController = Ember.Controller.extend({
show: function() {
var v = this.container.lookup('view:foo');
v.appendTo(App.rootElement);
}
});
根據你的版本,您將收到一個新的警告消息:
DEPRECATION: Action handlers implemented directly on controllers are deprecated in favor of action handlers on an actions
object (show on )
在這種情況下,把你的行動在actions
對象:
App.IndexController = Ember.Controller.extend({
actions: {
show: function() {
var v = this.container.lookup('view:foo');
v.appendTo(App.rootElement);
}
}
});
這是一個更新jsbin使用最新的餘燼版本無警告http://jsbin.com/uqawux/4/edit