Monday, 5 June 2017

Jade : Each loop explained?

Assuming person is a javascript object that has firstname & lastname, in an each loop in jade (pug) template how do I render something like :

<li> <div>{person.firstname} ({person.lastname})</div> </li>

Below is what I got so far but it's kinda confusing me with the equal sign in the official documentation and couldn't find any example where the each loop uses multiple attributes of the "person" object through loop.

each person in persons li div = person.firstname = person.email

The parenthesis are needed for the person.lastname and not a mistake.

Thanks for your help



via adaba

No comments:

Post a Comment