Javascript 为什么我会得到“UncaughtTypeError:无法读取未定义的属性“helpers”?
我的Meteor项目中有一个html:Javascript 为什么我会得到“UncaughtTypeError:无法读取未定义的属性“helpers”?,javascript,meteor,meteor-blaze,meteor-helper,Javascript,Meteor,Meteor Blaze,Meteor Helper,我的Meteor项目中有一个html: <head> <title>The Dentist Hurt My Fillings</title> </head> <body> <h2>Thirteen Ways of Looking at a Duckbilled Platypus</h2> <br/> <br/> <div class="container"> {
<head>
<title>The Dentist Hurt My Fillings</title>
</head>
<body>
<h2>Thirteen Ways of Looking at a Duckbilled Platypus</h2>
<br/>
<br/>
<div class="container">
{{> whizzardBlizzard}}
</div>
</body>
<template name="whizzardBlizzard">
<form>
{{#if firstStep}}
{{> firstStepTemplate}}
{{/if}}
{{#if secondStep}}
{{> secondStepTemplate}}
{{/if}}
{{#if thirdStep}}
{{> thirdStepTemplate}}
{{/if}}
<input type="submit" value="Submit" class="button">
</form>
</template>
<template name="firstStepTemplate">
<h2>Step 1</h2>
</template>
<template name="secondStepTemplate">
<h2>Step 2</h2>
</template>
<template name="thirdStepTemplate">
<h2>Step 3</h2>
</template>
当我试着运行它时,我得到,uncaughttypeerror:无法读取未定义的属性“helpers”
怎么可能呢?模板助手是Meteor的一个关键组件,它的使用示例反映了我的想法
我尝试过使用和不使用帮助者名称,如单引号中的firstStep;也就是说,我已经尝试了这两种方法:
firstStep: function() {
…这是:
'firstStep': function() {
…虽然这样称呼它:
{{#if firstStep}}
{{> firstStepTemplate}}
{{/if}}
那么为什么“助手”据说是不可读的呢?你的助手中的暴雪只有一个z:Blizard我几乎可以肯定这归结为一个加载顺序问题:你试图在定义模板之前定义你的助手。那么我能做些什么来避免呢?因为它是。。未定义。那么,;为什么?调试器(如果停止)将非常擅长显示当前状态,包括检查堆栈。不,它不是未定义的。问题是,假设Kyll是对的,如何安排事情,使其在执行.html文件中的定义之前不被.js文件引用。如果这是正确的答案,那么问题应该以打字错误结束。
{{#if firstStep}}
{{> firstStepTemplate}}
{{/if}}