【发布时间】:2017-04-22 23:31:53
【问题描述】:
我在我的 Meteor 项目中使用 flowrouter,我正在尝试弄清楚如何将它与 autoform update 一起使用。换句话说,我正在尝试创建一个表单来更新我的实体。这意味着需要以某种方式将对象传递给模板,但我不确定如何根据autoform docs 你应该这样做;
<template name="updateBookForm">
{{> quickForm collection="Books" doc=this id="updateBookForm" type="update"}}
</template>
但是这个例子是关于铁路由器的。我需要哪些额外的代码才能使自动表单更新与流路由器一起使用?
更新...
我尝试了以下
Template.UpdateItem.helpers({
item: function () {
var theItem = Items.findOne({_id: FlowRouter.current().params.itemId});
console.log("the item:"+JSON.stringify(theItem));
return theItem
}
});
在我的模板中
{{#with item}}
<div>
{{> autoForm collection="Items" id="updateItemForm" doc=item class= "new-item-form" type="update"}}
</div>
{{/with}}
但我还是在发呆……
【问题讨论】:
标签: forms meteor meteor-autoform flow-router