AutoForm & Iron Router で Meteor を使用しています。
データを挿入するためのオートフォームがあり、挿入が成功した後に追加したデータのページにリダイレクトしたいと考えています。どうすればいいですか?
対象は次のとおりです。
{{#autoForm collection="Products" id="add" type="insert"}}
<h4 class="ui dividing header">Products Information</h4>
{{> afQuickField name='name'}}
{{> afQuickField name='info'}}
<button type="submit" class="ui button">Insert</button>
{{/autoForm}}
アイアンルーター:
Router.route('/products/:_id', {
name: 'page',
data: function() { return Products.findOne(this.params._id);}
});
コールバック/フック
AutoForm.hooks({
add: {
onSuccess: function(doc) {
Router.go('page', ???);
}
}
});