简体   繁体   中英

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.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM