私はこの HTML/Handlebars コードを持っています。私が望むのは、「アウトレット fav」が ID「fav」のテンプレートとそれに対応する「インデックス」を持つアウトレット/テンプレート チェーンをレンダリングすることです。インデックスの一部として別の Ember URL を表示するようなものです。それはネイティブに可能ですか(iframeを補足することなく、これは悪い考えだと思います)?それは良い習慣と見なされますか(ビューを使用すると役立つかもしれませんが、この道を歩いても大丈夫かどうか疑問に思っています)?
<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'});
}
});
出力: =================================== ここにアプリケーションがあります アプリケーションの最初の子 お気に入り リンク A リンクB =================================== 「fav/index」からコンテンツを表示する必要がある子アウトレットを省略します 感謝します。