var resultTemplate = "" +
" <ul class='searchList'>" +
" <% _.each(paymentActions,function(paymentActivity){ %>" +
" <li><span class='amount visible-phone'>-<%= paymentActivity.grossAmount %></span>" +
" </li>" +
" <% }); %>" +
" </ul>";
var template = _.template(resultTemplate,{paymentActions : jsonData});
Error I am getting is(on the last line of the code snippet):-
Uncaught ReferenceError: paymentActions is not defined(…)
If I manually put a json Value in the var resultTemplate line instead of paymentActions it works fine. So the below code is executing fine:-
var resultTemplate = "" +
" <ul class='searchList'>" +
" <% _.each([{grossAmount:100},{grossAmount:200}],function(paymentActivity){ %>" +
" <li><span class='amount visible-phone'>-<%= paymentActivity.grossAmount %></span>" +
" </li>" +
" <% }); %>" +
" </ul>";
Can anyone help to debug this?