I'm trying to send a function as parameter to a jQuery template and display the first element returned by the function.
In the following example, data variable is a function and I'm trying to append first element returned. It's not a solution to store data into a variable because there are many cases when data is an array, not a function.
var template= ' {{each things}}{{if $index == 0}}<span>${this.Name}</span>{{/if}}{{/each}}';
$('.dropdownText').text(jq.tmpl(template, data));
I am not sure if i got the question rigt but if the problem is data can be a function or array you probably just have to do this