2014-02-23 27 views
1

我試圖通過Ember直接在<body>標記下呈現標題元素,並且很難將其拉下B/C Ember將所有內容都包裹在主應用程序<div>標記中。所以,我想有一個文檔結構大致是這樣的:在應用程序的上下文中,是否可以直接在body標籤下呈現ember元素?

<html> 
    <head> 
    ... 
    </head> 
    <body> 
    <header> 
     ... content inside here is controlled by ember application ... 
    </header> 
    <div class='container'> 
     ... main content of the application ... 
    </div> 
    </body> 
</html> 

的問題是,如果我嘗試包括在主應用程序模板header標籤,它被包裹的應用div內。任何人都知道如何把它關掉?

回答

1

如何使用命名插座?你的應用程序模板看起來像:

<header> 
    {{outlet header}} 
</header> 

<div class='container'> 
    {{outlet main}} 
</div> 

,並在您的路線:

App.ApplicationRoute = Ember.Route.extend({ 
    renderTemplate: function() { 
    this.render({ outlet: 'header' }); 
    this.render({ outlet: 'main' }); 
    } 
}); 
相關問題