As a newcomer to the Jade/Pug template engine used in Express, I am faced with a challenge. I need to display the name property of each object within an associative array that is passed as a parameter to my pug template from an express route module.
I have attempted various methods, such as:
each element in listOfElements
p #{element.name}
where listOfElements is the parameter name being passed
Unfortunately, I have not achieved the desired outcome so far.
UPDATE
Currently, I am referring to the documentation which only provides an example using UL
tags (not suitable for my case).
Following the documentation's guidelines, I have tried the following approach:
ul
each element in listOfElements
li = element.name
However, the rendered page displays a list where each bullet point contains the text " = element.name"