我正在創建一個應用程序,其外觀與Google圖片搜索類似:https://www.google.ca/search?q=vancouver&um=1&ie=UTF-8&hl=en&tbm=isch&source=og&sa=N&tab=wi。在Ember.ListView中添加插座
我使用Ember.ListView
(http://emberjs.com/list-view/)成功創建了圖像列表。我想要一個List/Details界面,其中Details將顯示在popover中(如在Google中:嘗試單擊圖像)。
因此喜歡的模板:
{{view Ember.ListView contentBinding="model"}}{{outlet}}
會的作品。當我轉換到細節時,我可以看到詳細信息。但是,詳細信息輸出口應插入可滾動容器中,而不是在Ember.ListView
之外。我的第一個想法是在Ember.ListView
爲了延長推一個視圖,將在Ember.ListView
充當outlet
:現在
App.ListView = Ember.ListView.extend({
itemViewClass: App.ListItemView,
childViewsWillSync: function() {
this.removeObject(this.get(this, 'anOutletView'));
this._super();
},
childViewsDidSync: function() {
var anOutletView = this.get(this, 'anOutletView');
this._super();
if (!anOutletView) {
anOutletView = App.AnOutletView.create();
this.set('anOutletView', anOutletView);
}
this.pushObject(anOutletView);
}
});
App.AnOutletView = Ember.View.extend({
template: Ember.Handlebars.compile('{{outlet}}')
});
我的模板是:
{{view App.ListView contentBinding="model"}}
我能看到的App.AnOutletView
實例在DOM中,但是沒有任何內容被渲染。如果這一切能夠奏效,我會感到驚訝!
任何想法如何在Ember.ListView
上添加插座?任何想法,將不勝感激。
很多謝謝