I'm practicing node, and I ran to a little problem. I'm using handlebars as a templating engine, and mongoose for interaction with my database. In my .hbs template I am looping through each record from the database, and of course I passed the records to my view with
router.get('/', function(req, res, next) {
Exam.find(function(err, predmeti) {
if (err) {
console.log(err);
}
res.render('index',{
predmeti: predmeti
})
})
});
Now when im looping through predmeti
with #each, engine throws an error when I try doing math expressions such as
{{#each predmeti}}
<h1>{{100/(brKolokvijuma/finished)}}</h1>
{{/each}}
brKolokvijuma and finished
both have a number value, but for some reason I get a error Expecting ID got OPEN_SEXPR
So I'm assuming handlebars won't let me do math expressions when I'm looping through an array. How can I solve this?