I have some Underscore.js template that renders completely fine, except, the function called inside that template is undefined. For example:
<span class='<% checkClass(oldValue, newValue) %>'>
The function itself works completely fine outside the template and returns the class name as expected. Does Underscore templates have their our scope?
UPD: That's how template is defined and called:
function checkClass() {... return 'Something' ...}
pData = [Object]; //Just for reference
var rowsTpl = _.template("<span class='<% checkClass(oldValue, newValue) %>'>");
_.each(pData, function (vals, name) {
prOutput = rowsTpl(vals);
$(this.elem).html(prOutput);
});