I’m running express with jade for templating, and backbone/underscore on the client-side code. I’d like to use a jade loop to iterate through an array, and construct divs for each of them.
.members
each elem in <%= members %>
.member elem
Of course this won’t work since the jade template is compiled and served by express… Any solutions, short of just formatting members separately and inserting it like this? I’d prefer not to compile jade on the client side either.
.members
<%= members %>
I’m not sure I understand your question. If ‘members’ is a server-side variable, why wouldn’t you just use this?
Edit: Ah I see, so if you’re trying to get it on the client side, you can do something along the lines of:
Then, you have ‘members’ as a variable client-side and you can do whatever you want with it (including rendering it in an underscore template).