September 2013
Beginner to intermediate
480 pages
9h 59m
English
Jade also supports rendering lists of items as other template languages. We can use the each construct to iterate through the elements in the array and output some HTML elements for each.
In this recipe, we're going to render a list of message objects. Each message object will have an author, arrival time, body, and read status. We're going to use a different style to distinguish between read and unread messages.
We're also going to use different backgrounds for odd and even rows.
We need to download jade.min.js in to our recipe folder available at https://github.com/visionmedia/jade.
Follow these steps:
index.html containing the CSS style, placeholder, and the template script element: ...Read now
Unlock full access