javascriptbackbone.jsjst

Doing native javascript inside of a JST backbone.js template


I am trying to do a loop inside of a JST file:

data.who

["Arthur", "Craig", "Dan", "Daniel"]

JST

<date><% data.who.forEach(function(myself){ %>
    <%= myself %>
<%  }) %></date>

No idea and couldn't find loops in the document ion for JST, just trying to apply logic from PHP.


Solution

  • Turns out I was a little bit silly, but data was not defined inside the JST

    Make sure you have defined it inside of your view calling the JST