【发布时间】:2013-07-03 06:25:40
【问题描述】:
我对 Meteor 还很陌生,只是尝试使用 Transitioner 构建我的第一个流星应用程序。
所以我要做的是在传递给另一个模板的字符串等于某个值时加载不同的模板。 HTML 代码:
<template name="onePage">
{{#if itIs "teams"}}
{{> teams}}
{{/if}}
{{#if itIs "players"}}
{{> players}}
{{/if}}
</template>
<template name="teams">
<h2>These are the TEAMS</h2>
</template>
<template name="players">
<h2>These are the PLAYERS</h2>
</template>
JS代码:
Template.onePage.itIs = function(passed) {
return this === passed;
};
由于某种原因这不起作用,我只是不明白为什么。 唯一的一点是传递给 onePage 模板的“this”是一些字符串(来自 URL)。如果这个字符串是“teams”我想加载teams模板,如果是“players”我想加载players模板。
就这么简单! :-)
很遗憾,我无法解决这个简单的问题。
希望你们能理解我的问题并提供帮助!
最好的问候 帕特里克
【问题讨论】:
标签: meteor handlebars.js