meteorjs 模板助手问题
meteorjs Template helper Issue
我是 meteor 的新手,所以如果这是另一个主题的重复。抱歉 还在习惯术语。
我无法从我的客户端 javascript 提取一些信息到我的模板我不知道这是否是因为我设置的名称 space 不正确。
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
我不确定这是否会阻止我尝试做的事情?
任何帮助将不胜感激!!
提前致谢!
您的问题在 product.html。在空格键中,您只使用 >
来表示模板。如果您将 product.html 更改为下面的内容,它应该可以工作。您直接在空格键中引用属性,而不是使用 >
<template name="product">
{{text}}
</template>
我是 meteor 的新手,所以如果这是另一个主题的重复。抱歉 还在习惯术语。
我无法从我的客户端 javascript 提取一些信息到我的模板我不知道这是否是因为我设置的名称 space 不正确。
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
我不确定这是否会阻止我尝试做的事情?
任何帮助将不胜感激!!
提前致谢!
您的问题在 product.html。在空格键中,您只使用 >
来表示模板。如果您将 product.html 更改为下面的内容,它应该可以工作。您直接在空格键中引用属性,而不是使用 >
<template name="product">
{{text}}
</template>