Questions tagged [handlebars.js]

Handlebars is a templating library for JavaScript.

Handlebars is a template library that is, more or less, based on . Handlebars uses Mustache template syntax to render templates but it also adds these features compared to Mustache:

  • Handlebars templates are compiled
  • Handlebars adds #if, #unless, #with, and #each
  • Handlebars supports custom helpers
  • Handlebars supports paths
  • Allows use of {{this}} in blocks (which outputs the current item's string value)
  • Handlebars.SafeString() (and maybe some other methods)
  • Handlebars is 2 to 7 times faster

However Mustache supports inverted sections (i.e. if !x ...) that are not used in Handlebars

Handlebars is used in as a Templating engine, Ember.js add some additionnal builtin helpers to the vanilla Handlebars.js. can also use handlebars when installed with the hbs option : --hbs


Resources :

7662 questions
2
votes
1 answer

Pass through JSON array using Handlebars template engine

This is my JSON and I want to know how can I show my information into page using handlebars template engine: This is my template (script): The template is called from express with response.render('template', {list: [1, 2, 3]})
Theodor
  • 5,536
  • 15
  • 41
  • 55
2
votes
1 answer

Could you please help me troubleshoot a Handlebars template?

So I'm working on an admin panel to help someone at work manage data for a web application I'm building. I'd like to use Handlebars templates to build out different admin panels for different tables in a database. However, I can't even get a test…
2
votes
0 answers

Handlebars variable rendering

I have the following data in the Handlebars template: var1 : 'John' var2 : 'Hello {{var1}}' Template looks like: Hello {{var1}} {{var2}} Result is: Hello John Hello {{var1}} The question is: Exists some way to setup Handlebars to render {{var1}}…
Jiri Mihal
  • 432
  • 3
  • 11
2
votes
0 answers

Handlebars gives an error when loading the application in an iFrame only in IE11 above

I am getting following error from Handlebars when I am running the application within an iframe only in IE11 above. I have tested application directly without loading via iFrame in IE11 above and works perfectly well. Also works fine in IE10 as…
fernando
  • 707
  • 8
  • 24
2
votes
1 answer

Meteor Handlebars: value in array in {{#each}} block

I'm new to Meteor/Handlebars using the meteor package https://atmospherejs.com/aldeed/plans-stripe which contains these two helpers. AppPlans.listDefined() - to get the list of all our plans - ["free", "monthly", "yearly"] AppPlans.get() - to see…
user1400803
2
votes
1 answer

Handlebars and Javascript

It's a good practice to include js file as partials in Handlebars? I mean, I need to use some data from nodejs in my jquery-based javascript, and to do this I load my js as partials in handlebars template and then use handlebars notation directly,…
shaithana
  • 2,470
  • 1
  • 24
  • 37
2
votes
1 answer

ember-view wrapper is breaking my table

I am new to ember and working on a simple test app. I am trying to render the rows of a table dynamically from json data. The task is relatively simple. However each row is a component and ember wraps the element in a div with class ember-view. I…
Scott Wright
  • 186
  • 1
  • 11
2
votes
1 answer

Recursive Handlebars.js Template. How to determine the depth?

after hours of searching i couldn't find the correct answer for my question. I have an arbitrary tree depth I'd like to display with handlebars. There is a good fiddle example for recursive templating in handlebars (…
Michael Z
  • 25
  • 4
2
votes
3 answers

Ember-data: model refresh on DS.Store.createRecord

Embsters! I am trying to figure out why my model isn't refreshed after I create a new record and save it to the store. My route computes the model as follows: model: function (params) { var postID = params.post_id, userID =…
Brou
  • 90
  • 8
2
votes
1 answer

Getting template was precompiled with a newer version of Handlebars error with my Node.JS app?

I am trying to create a Node.JS app that uses the open source Alpaca Forms package: http://www.alpacajs.org/ I'm using Node version: v0.10.25 When I run the test page from the tutorial: http://www.alpacajs.org/tutorial.html Using the second sample…
Robert Oschler
  • 14,153
  • 18
  • 94
  • 227
2
votes
1 answer

How to split array of objects by status using Handlebars.js?

I am a beginner in coding and this is a very stupid question: I have 3 different columns with tasks: waiting / working / done External js file with array: var tasks = [ { title: 'First Task', picUrl: 'imgs/test.jpg', …
2
votes
2 answers

Running Handlebars multiple times within a Gulp task

I'm trying to create a Gulp task that applies two Handlebars processes to a src. The first process uses an external JSON data source and populates a template. Then for an additional process, I want to parse another expression in the template with a…
Frank Furter
  • 508
  • 1
  • 6
  • 15
2
votes
1 answer

How to display key, value for each object (Handlebars.js)?

I have incoming JSON: [{"key":"browser","value":"Chrome"}, {"key":"geo","value":"false"},{"key":"os","value":"MacOS"}] And I have to display this by using Handlebars template. I can't use the construction below because **sometimes I have only 2…
Arsenowitch
  • 401
  • 5
  • 22