It should be...
{{if this.getFileLimit()}}
It's also worth mentioning that jQuery Template is a dead project. If this is a new project, you may be better off with something else.
Pregunta
I've got the following tmpl
{{if (${this.getFileLimit()})}}
<div class="files_wrapper">
<div class="add-files">Click to add items</div>
</div>
{{/if}}
And the JS Code:
$('.addFiles').html($("#template").tmpl(data,{
getFileLimit: function(){
if (Object.size(data.items) == 10)
return false;
else
return true;
}
}))
So in general function ${this.getFileLimit()} works (it renders text on screen), but no luck to add it inside IF statement, always get errors.
Uncaught SyntaxError: Unexpected token {
Anyone have and idia how to use functions inside IF?
Solución
It should be...
{{if this.getFileLimit()}}
It's also worth mentioning that jQuery Template is a dead project. If this is a new project, you may be better off with something else.