【问题标题】:meteorjs Template helper Issuemeteorjs 模板助手问题
【发布时间】:2015-10-25 04:03:12
【问题描述】:

我是流星新手,所以如果这是另一个主题的重复。抱歉 还是习惯了术语。

我无法从客户端 javascript 中提取一些信息到我的模板中,我不知道这是不是因为我错误地设置了名称空间。

main.html

    <head>
      <title>Some Title</title>
    </head>

    <body>
      {{> navigation}}
       <div class="container">
         <div class="row">
            <div class="col-md-3 col-xs-3">
              {{> product_options}}
            </div>
            <div class="col-md-9 col-xs-9">
              {{> products}}
            </div>
          </div>
        </div>
       {{> footer}}
     </body>

products.html

<template name="products">
  {{#each products}}
    {{> product}}
  {{/each}}
</template>

product.html

<template name="product">
  {{> text}}
</template>

products.js

Template.products.helpers({
    products: [
      { text: "This is task 1" },
      { text: "This is task 2" },
      { text: "This is task 3" }
    ]
  });

我也从我的项目中删除了这些

autopublish  
insecure

我不确定这是否会阻止我尝试做的事情?

任何帮助将不胜感激!

提前致谢!

【问题讨论】:

    标签: meteor meteor-helper


    【解决方案1】:

    您的问题在 product.html 中。在空格键中,您只使用&gt; 来表示模板。如果您将您的 product.html 更改为下面的内容,它应该可以工作。您直接在空格键中引用属性,而不是 &gt;

    <template name="product">
      {{text}}
    </template>
    

    【讨论】:

    • 对,我看的不够仔细,误导大家见谅。
    • @TomFreudenberg 没问题,感谢您的帮助 :)
    猜你喜欢
    • 1970-01-01
    • 2015-08-15
    • 2015-08-23
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-01-06
    • 2013-02-14
    • 1970-01-01
    相关资源
    最近更新 更多