【问题标题】:meteor blaze renderwithdata pass document to template with autoform流星火焰渲染与数据将文档传递给带有自动生成的模板
【发布时间】:2015-12-15 18:13:16
【问题描述】:

我有以下模板:

<template name="editUser">
    {{> quickForm collection="Users" doc=doc id="editUserForm" type="update"}}
</template>

然后我使用以下方法在弹出框 div 中渲染它:

  Blaze.renderWithData(Template.editUser, data, target);

想传quickform需要的doc变量,对data参数不太了解。

我尝试将以下内容用作数据:

var data = {doc: Users.find({_id: feature.getId()}).fetch()};

但这似乎不是在变量 doc 中传递文档的方式。

我找不到如何正确使用它,并希望避免使用会话变量。

【问题讨论】:

    标签: javascript meteor meteor-blaze meteor-autoform


    【解决方案1】:

    我刚刚意识到我需要传递光标而不是数据本身。所以当我替换它时它可以工作:

    var data = {doc: Users.find({_id: feature.getId()}).fetch()};
    

    var data = {doc: Users.find({_id: feature.getId()})};
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2016-11-17
      • 1970-01-01
      • 2023-03-16
      • 2016-05-18
      • 1970-01-01
      • 2017-02-09
      • 1970-01-01
      • 2014-05-07
      相关资源
      最近更新 更多