jade 中的 Foreach 循环(node.js 模板引擎) [英] Foreach loop in jade (node.js template engine)

查看:32
本文介绍了jade 中的 Foreach 循环(node.js 模板引擎)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

好的,我正在从节点服务器获取一个关联数组并尝试在 Jade 中呈现它.我显然需要一个 foreach 循环,但似乎没有任何效果!我试过这两个代码:

Ok, I am getting an associative array from node server and trying to render it in Jade. I obviously need a foreach loop, but nothing seems to work! I tried these both codes:

- foreach row in rows {
    li= row
- }

- rows.forEach(function(item)) {
    li= item
- })

我传递的数组称为行".知道为什么这不起作用吗?我收到此错误:

the array I am passing is called "rows". Any idea why this is not working? I am getting this error:

500 SyntaxError: Unexpected identifier

并且,使用第二个代码:

and, with the second code:

500 SyntaxError: Unexpected token )

推荐答案

try

each item in rows
    li= item

这篇关于jade 中的 Foreach 循环(node.js 模板引擎)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆