html - 在 express 中使用 @foreach 循环遍历 mongoDB 数据库数组
问题描述
嗨,我有一个数据库,我可以在视图中使用
html 和 express 布局我认为@each 和 {{}} 是一种 js 语法
{{posts[0].detail}} <----------------This works
但我想使用显示帖子的所有内容
@each(post in posts)
{{post[don't know what to put here].detail}}
@end
解决方案
@Cristy 的 {{post.detail}} 怎么样?
所以这回答了我的问题。
我以为@each(post in posts) <-----你必须使用posts.detail
现在我知道 post 具有帖子的属性。
前任:
@each(post in cars) <------ 仍然是 post.detail 。