Last active
August 29, 2015 14:15
-
-
Save timaschew/034c735f2deceb97d874 to your computer and use it in GitHub Desktop.
loop over an array via a mixin
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
externalArray: [ | |
{id: 1, name: "foo"}, | |
{id: 2, name: "bar"}, | |
{id: 3, name: "qux"} | |
] | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mixin showList(list) | |
div.container | |
each item in list | |
div.item | |
span=item.id | |
span=item.name | |
+showList(externalArray) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
go on this site: http://jade-lang.com/demo/
put the locals in the top right textarea and the template into top left textarea
see the result in the bottom right textarea