M
M
MR.TOSTER Gipard Valerievich2016-09-05 12:06:16
HTML
MR.TOSTER Gipard Valerievich, 2016-09-05 12:06:16

How to display an array of objects in a .jade file?

var users = [{name:"Sony"},{name: "Xbox"}]; // Sent to file.jade with renderFile
_____file.jade
ul
li
What does file.jade need to be to get this?:

<ul>
<li>Sony</li>
<li>Xbox</li>
</ul>

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dmitry Kravchenko, 2016-09-05
@zoceb

ul
  each val, index in ['zero', 'one', 'two']
    li= index + ': ' + val

documentation
ul
  each user, index in users
    li= user.name

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question