1
我有这个HTML/Handlebars代码,我想为“outlet fav”呈现 id为“fav”的模板及其与期望的“index”相对应的出口/模板链。有点像显示一个不同的Ember URL作为索引的一部分。原生可能(没有补充iframe,我认为这是一个坏主意)?它会被认为是一个好的做法(我知道使用视图可能有帮助,但只是想知道走这条路是否可行)?Ember模板链接
<script type="text/x-handlebars" id="application">
Here we have our application
{{outlet}}
</script>
<script type="text/x-handlebars" id="index">
Application's First Child
{{outlet}}
</script>
<script type="text/x-handlebars" id="index/index">
Your Favourites
{{outlet fav}}
</script>
<script type="text/x-handlebars" id="fav">
{{#link-to 'fav'}}All{{/link-to}} <!-- Link A-->
{{#link-to 'fav.top'}}Top{{/link-to}} <!-- Link B-->
<!-- Expected Output from "fav/index" -->
{{outlet}}
</script>
<script type="text/x-handlebars" id="fav/index">
All Favourites Content
</script>
<script type="text/x-handlebars" id="fav/top">
Top Favourites Content
</script>
<script type="text/x-handlebars" id="football">
Football Content
</script>
JS代码: 这里就是我试过
App.Router.map(function(){
this.resource('index', {path: '/'}, function(){
this.resource('fav', function(){
this.route('top');
this.route('last');
});
});
this.route('football');
});
App.IndexIndexRoute = Ember.Route.extend({
renderTemplate: function() {
this.render();
this.render("fav", {into: 'index'});
}
});
Output: =================================== Here we have our application Application's First Child Your Favourites Link A Link B =================================== Omits the child outlet which should display content from "fav/index" Help Appreciated.