I am trying to show list of users in PUB. This is my code
- var users = !{users};
h1 UserList
for user in users
a(href='/deleteuser/' + user.id) user.name user.surname
This is rendering code
var users = userDatabase.listUsers();
// Render a pug file.
var result = pug.renderFile('userlist.pug', {
users:users
});
res.send(result);
But only header is shown despite the user list is not empty(I have checked it). Can someone help, how can I show list of users on PUG in my example? How to correct code?
Solved it using this
h1 UserList
p Below you will see list of users.
br
each user in users
p= user.name + " " + user.surname + " "
a(href='/deleteuser/' + user.id) Delete
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.