[英]meteor blaze renderwithdata pass document to template with autoform
I have the following template: 我有以下模板:
<template name="editUser">
{{> quickForm collection="Users" doc=doc id="editUserForm" type="update"}}
</template>
And I render it in a popover div using: 然后使用以下命令在popover div中进行渲染:
Blaze.renderWithData(Template.editUser, data, target);
I would like to pass the doc variable required by the quickform and don't really understand the data parameter. 我想传递quickform所需的doc变量,但我不太了解data参数。
I tried to use the following as data: 我尝试将以下内容用作数据:
var data = {doc: Users.find({_id: feature.getId()}).fetch()};
but this does not seem to be the way to pass a document in the variable doc. 但这似乎不是在变量doc中传递文档的方法。
i could not find how to properly use it and would like to avoid a session variable. 我找不到如何正确使用它,并希望避免会话变量。
I just realized that I need to pass the cursor and not the data itself. 我只是意识到我需要传递游标而不是数据本身。 So it works when I replace:
所以当我替换时它起作用:
var data = {doc: Users.find({_id: feature.getId()}).fetch()};
with 与
var data = {doc: Users.find({_id: feature.getId()})};
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.