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 :

7223 questions
2
votes
2 answers

Specify controller for Ember.js template render helper programmatically?

The case is I want my {{render}} to infer a controller name from supplied ember-data model's name automatically. e.g. in {{render 'animal' animal}}, if animal is a Cat, I hope the template is rendered with a CatController It seems that the render…
Pinyin
  • 526
  • 4
  • 18
2
votes
2 answers

Bind this to a handlebars button

So I got a large JSON with many items nested into topics and I use mustache.js to make a button from each topic. Now I want to bind a reference to the sub-object into each button so that its onClick() will not have to perform a heavy lookup and…
akiva
  • 2,408
  • 3
  • 27
  • 38
2
votes
1 answer

Where to place templates for nested routes in Ember.js apps using pods?

Where should the template files be placed for nested routes when using the pod structure in ember-cli? Here is what I have at the moment. Visiting /foo works Expected and actual result: app/foo/template.hbs gets rendered. Visiting /foo/bar does…
bguiz
  • 22,661
  • 40
  • 140
  • 226
2
votes
1 answer

Sails.js, Ember, Handlebars and configuration via grunt-ember-templates: templates file not created

Found the link Sails JS with EJS but linker to compile handlebars public templates and it looks straight forward but somehow it does not work with my current sails version with jade Here's the current Grunt Configuration in…
tomatom
  • 359
  • 3
  • 9
2
votes
1 answer

Navigation using Assemble

Part I I created a 'static' navigation in my handlebar file for the header (header.hbs - below). I'd like to create this simple, one-level navigation using handlebars (which I'm new too currently). Also would like to add an "active" class based on…
Sal B
  • 508
  • 5
  • 19
2
votes
1 answer

Pass string parameter into assemble partial

I'm trying to pass a string parameter into a partial This is my call to my partial. {{> loginButton hide-on-mobile}} This is my partial For some reason the value isn't being displayed. What am I…
Tom Maton
  • 1,494
  • 2
  • 18
  • 38
2
votes
3 answers

Meteor Blaze HTML: conditional templates inside each loop

I have 3 people, each with unique answer to the same question. 1 template shows the name and question. Another different template holds the answer. (4 total templates. 1 for names/question, 3 other - 1 for each unique answer).
DeBraid
  • 4,922
  • 5
  • 26
  • 42
2
votes
0 answers

How to get gulp-handlebars to recognize partials

I am having trouble getting handlebars to locate my partials. I have a nested folder structure that looks like the…
Brandon
  • 2,468
  • 2
  • 24
  • 41
2
votes
2 answers

ember 1.7.1 not working with handlebars 2.0.0

I'm currently working on a new ember project after a smooth and successful one page angularjs application. So I prepared my work folder, and ironically the second I start using emberjs i.e as soon as I reference the script tag it throws up an error…
Millzie
  • 302
  • 1
  • 3
  • 13
2
votes
0 answers

Assertion Failed: You included Ember Data but didn't define OL_segments.Store

I'm currently getting this error in my console: Assertion Failed: You included Ember Data but didn't define OL_segments.Store I've done a search already and previously, this was an issue in older versions of Ember. See…
iamryandrake
  • 513
  • 2
  • 7
  • 29
2
votes
1 answer

.hbs syntax highlighting in Coda (OSX)

Does anyone know how I can enable syntax highlighting for .hbs files in Coda? At the moment everything is in white. If I rename the file to something.html it works.
JonathanBristow
  • 1,056
  • 1
  • 11
  • 33
2
votes
2 answers

How to use Spanish characters in Handlebars templates

I am wondering what the idiomatic way to render special language characters is using Handlebars.js templates. When I render the normal html I can use something like the Spanish lowercase e, é, and it renders as expected. When I pass the same…
Jon Rose
  • 1,379
  • 1
  • 13
  • 24
2
votes
1 answer

Handlebar incrementing variable

I'm new to Javascript templating