【发布时间】:2015-07-06 09:07:40
【问题描述】:
我将 Meteor 与 AutoForm 和 Iron Router 一起使用。
我有一个用于插入数据的自动表单,我想在插入成功后重定向到我添加的数据的页面。我该怎么做?
这是为了:
{{#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', ???);
}
}
});
【问题讨论】:
标签: meteor iron-router meteor-autoform