I'm trying to use the @math helper in a dust template to add 1 to a value. My data looks like:
{
array:[5,10,20]
}
My dust template looks like:
{#array}
<div class="span2">Amount {@math key="{$idx}" method="add" operand="1"/}:</div>
<div class="span2">{.}</div>{~n}
{/array}
This renders everything except for the @math. I'm using dust-full-1.2.2.js so the math helper is included. Any ideas why this isn't working?
dust-full-1.2.2.js
does not include any helpers, so that is a part of your problem. The helpers can be found here: https://github.com/linkedin/dustjs-helpers
The other problem is just a small syntax error. The @math
helper is self closing, so your code would look like this:
<div class="span2">Amount {@math key="{$idx}" method="add" operand="1"/}:</div>