【发布时间】:2019-03-16 04:44:58
【问题描述】:
您好,我有一个数据库,我可以使用
在视图中访问它html 和 express 布局我认为@each 和 {{}} 是一种 js 语法
{{posts[0].detail}} <----------------This works
但我想使用
显示帖子的所有内容@each(post in posts)
{{post[don't know what to put here].detail}}
@end
【问题讨论】:
-
语法
@each(post in posts)是什么语言。此外,您可能必须{{post.detail}}或{{posts[post].detail}} -
好吧,我使用 express 作为布局,使用 html 作为视图,这就是我所知道的我要尝试的帖子[post].detail
-
{{posts[post].detail}}
-
{{post.detail}}呢?你得到什么错误?另外,我没有看到 EJS 具有@each语法,您确定您使用 EJS 进行模板吗? -
@Cristy woooooooooooooooooooooooooooo 成功了,谢谢ssssssssss
标签: html node.js mongodb express