Questions tagged [express-handlebars]

474 questions
0
votes
1 answer

NodeJS crashed with three dots

I have a really weird problem with my nodejs project. The project is an online shop with express and handlebar and it has a mongo database connected. In the router section I have this code: router.get('/item/:item', function (req, res, next) { var…
0
votes
0 answers

How come I can't get express to move to a different url after POST

I am using express to Post form data to mongolabs and it's working fine, but I noticed that I am rendering my / page after the form posts instead of the /thanks page. I am using Express-Handlebars and it is using my /thanks template, but it's not…
Sean Kelly
  • 901
  • 7
  • 27
0
votes
1 answer

NodeJs Handlebars i18next calling helper inside another helper

can a wizard out there let me know if it is possible to call a helper inside another helper. i need to call an i18n helper inside a date format helper. i cannot seem to get it to work. was wondering if that is even possible with this plugin. here is…
0
votes
1 answer

How can get http response in javascript function after it is returned

I need to call a function passing response rendered to a express-handlebars page. How can I do this? This my controller and it is rendering result to a handlebars page. return servico.obterMetricasStatusCode() .then((resultado) => { …
0
votes
1 answer

Iterate over array of strings from helper in (express-)handlebars template with {{#each}}

I'm trying to iterate over an array of strings in a handlebars template with builtin helper '{{#each}}'. But it doesn't work. Simplified example: A custom helper function which returns an array of strings: helpers: { arr: function () { return…
0
votes
1 answer

How to render the table from SQL Server into front page

I use node express app with the mssql package (https://www.npmjs.com/package/mssql) to read data from my Azure SQL Server database. In general, I could read the table in the database, however, I don't know how to visualize the table into front page…
0
votes
1 answer

Handlebars helper not working with global variable in Express

I have an app running on Node, Express and express-handlebars. The variable is a result of a query assigned to res.locals and condition helper "ifCond" like this one. The code that needs to be rendered is a in a partial. The problem is that helper…
ASem
  • 142
  • 3
  • 16
0
votes
1 answer

Custom Express Handlebars If Helper

I'm iterating over an array object utilizing express-handlebars and only every second dom element which is created should have a specific attribute. Something like this:
I noticed…
Matthias Herrmann
  • 2,650
  • 5
  • 32
  • 66
0
votes
2 answers

Rendering data in handlebars using express framework

Hello I am working in Express Framework, I am using handlebars to render the data from my mysql table. While trying to render the data using below code,instead of rendering value it displaying [object object]. I posted my code below. index.js: var…
Kannan K
  • 4,411
  • 1
  • 11
  • 25
0
votes
2 answers

Nodejs express handlebars post 404 error '/checkout'

I'm building a shopping cart project using Node, Express, handlebars and MongoDB. Currently, when I attempt to submit a form, using Jquery, I receive a 404 error for my '/checkout' file. Originally, I used return false to prevent the form from…
0
votes
0 answers

How to render and iterate through JSON with handlebars

I have JSON file called twitData.json that looks like this: I want to iterate over it using Handlebars and Express, and pass it to a partial to be implemented as html code. I have included the JSON file in server.js. I use res.render in server.js…
0
votes
1 answer

can not detect current language (i18next.language) from handlebar helper?

I am using following packages for multi-languages solutions. var i18next = require('i18next'); var i18nFsBackend = require('i18next-node-fs-backend'); var i18nMiddleware = require('i18next-express-middleware'); Since I am using handlebar as my…
0
votes
1 answer

counting properties of an object of a certain value in express/handlebars/mongoose

Creating a friends system in express/handlebars/mongoose. I'm using {{friends.length}} to show the total number of friends a user has, but how would I show the total types of friends. eg. how many of those friends have status of 0 or 1. 0 =…
totalnoob
  • 2,521
  • 8
  • 35
  • 69
0
votes
1 answer

Replacing Jade for ... in loop with Handlebars

I need convert Jade select list which iterates over statuses and assigns a status to an account into Handlebars template. In Jade it looks like this: select.form-control(name='status') option(value='') -- choose -- for status in…
ASem
  • 142
  • 3
  • 16
0
votes
1 answer

Passing the being looped element to event handler

How do I pass the element that is being loop to event handler. foo.hbs
{{#each products}} // some html code

{{this}}

Sithideth Bouasavanh
  • 1,011
  • 1
  • 11
  • 20