これは私の前の質問へのフォローアップです。
私のRouter
基本的には次のようになります。
App.Router.map(function () {
this.resource('posts', function () {
this.resource('post', {
'path': '/:post_id'
}, function () {
this.route('edit');
this.resource('comments');
this.resource('trackbacks');
});
});
});
post
myとpost/edit
templateの両方を同じ にレンダリングしたいので、このため{{outlet}}
に をオーバーライドしPostEditRoute
ました (したがって、renderTemplate
これを処理する )。のモデルmodel
を使用するには、オーバーライドする必要があります。PostRoute
App.PostEditRoute = Ember.Route.extend({
model: function() {
return this.modelFor('post');
},
deactivate: function() {
this.currentModel.get('transaction').rollback();
},
renderTemplate: function() {
this.render({
into: 'posts'
});
}
});
私のpost/edit
テンプレートには、ビューに「リダイレクト」したいキャンセルpost
リンクが含まれています。
<script type="text/x-handlebars" data-template-name="post/edit">
{{view Em.TextField valueBinding="title"}}
{{view Em.TextArea valueBinding="description"}}
{{#linkTo post}}Cancel{{/linkTo}}
</script>
しかし、ここから問題が始まります。[キャンセルpost
] リンクをクリックすると、テンプレートに空白の領域が表示されます。
#linkTo
また、ヘルパーにパラメーターを渡すことも試みました( #linkTo post this
); post
テンプレートは表示されUncaught RangeError: Maximum call stack size exceeded
ますが、 に戻るとエラーになりますpost/edit
。
post
私の質問:にキャンセルしたときに戻るにはどうすればよいpost/edit
ですか?