I’m working with jQuery 1.8.2 & Dust.js v1.1.1 for MVC-style templating within a JavaScript app. When I use the {@gt} logic helper I receive the following console error:
Uncaught TypeError: Cannot read property 'gt' of undefined
I believe the proper syntax is used in my template:
<ul class="listview">
{#seasons}
<li>
<h3>{name}</h3>
<p class="desc">{id}</p>
{@gt key="months" value="0"}
<span class="count">{months}</span>
{/gt}
</li>
{/seasons}
</ul><!--// end .listview -->
Here’s the JSON structure:
{
"seasons":[
{
"name":"Spring",
"id":"weklv7",
"months": 8
},
{
"name":"Summer",
"id":"lvuec5",
"months": 4
}
]
}
If I remove the {@gt} logic helper from the template, the error disappears and the template is loaded correctly as HTML. For example:
<ul class="listview">
{#seasons}
<li>
<h3>{name}</h3>
<p class="desc">{id}</p>
<span class="count">{months}</span>
</li>
{/seasons}
</ul><!--// end .listview -->
Any help is much appreciated, thanks!
It sounds like your problem is that dust.helpers doesn’t exist, probably because it was removed from Dust core. Make sure you have Dust core and Dust helpers loaded wherever your templates are being rendered.