0

Ember.js pre4 で子ビューを接続する正しい方法を見つけようとしています。

クラス App.ContactsShowView のテンプレートとして次の html を設定しています。

<div class="container">
    <h1>Show Contact</h1>    
    ID:{{id}}
</div>
 Info:
{{outlet infoarea}}

ContactsShowinfoView を上記のアウトレット infoarea にレンダリングしたいと思います。

App.ContactsShowinfoView = Ember.View.extend({
    templateName: 'contact/templates/contactsShowinfoView',
});

ドキュメントを読むと、Route の renderTemplate メソッドを介してこれを行う必要があるようです。次のコードの複数のバリエーションを試しました。

App.ContactsShowRoute = Ember.Route.extend({
    renderTemplate:function() {
        this._super();
        this.render( "contactsshowinfo", {
            outlet:"infoarea"

        });
    }
});

せいぜい、エラー メッセージが表示されず、ContactShow ビューが表示されるだけです (しかし、いいえ、アウトレットに接続してください)。

明らかな何かが欠けていますか?

4

1 に答える 1

1

ビュー/テンプレートに一貫した名前を使用していません。これを試して:

App.ContactsShowInfoView = Ember.View.extend({
    templateName: 'contact/templates/contactsShowInfoView',
});

App.ContactsShowRoute = Ember.Route.extend({
    renderTemplate:function() {
        this._super();
        this.render( "contactsShowInfo", {
            outlet:"infoarea"

        });
    }
});
于 2013-02-10T18:58:35.700 に答える