玉的Foreach循环(node.js模板引擎) [英] Foreach loop in jade (node.js template engine)
本文介绍了玉的Foreach循环(node.js模板引擎)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
pre $
- foreach row in rows {
li = row
- }
和
li = item
- })
我传递的数组叫做rows。任何想法,为什么这是行不通的?我得到这个错误:
500 SyntaxError:意外的标识符
$ p
和第二个代码:
500 SyntaxError:意外的令牌)
解决方案try
行中的每个项目
li =项目
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 - }
and
- 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
这篇关于玉的Foreach循环(node.js模板引擎)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文