I have an array known as sem
containing multiple objects and an object known as result
containing properties href
and content
which contain strings. They are being rendered to the view as follows:
Here i am using async
to run functions in parallel so that i can pass 2 different variables into the view. Reference
app.js
res.render('sem/semester', {
sem: sem,
result:result
});
The array sem
contains:
sem: [
{semNumber: 2, collegeName: 'blalblalbla'},
{semNumber: 3, collegeName: 'dfhgfh'}
{semNumber: 4, collegeName: 'dsfdsdsf'}
];
The object result
contains:
result: {href: 'url', content: 'Some text'}
TARGET
In semester.handlebars
{{#each sem}}
<div>{{semNumber}}</div>
<div>{{collegeName}}</div>
<a href="{{result.href}}">{{result.content}}</a>
{{/each}}
I did the above, but the properties of result
i.e href
& content
do not get displayed in an each
loop.
Output must be:
2
blablablabla
Some text
3
dfhgfh
Some text
4
dsfdsdsf
Some text
EDIT: (The url contains a handlebar expression which would render from the array sem)
Example: /marks/edit_marks/semester_number={{semNumber}}/{{id}}