Tag Archives: handlebars

Handlebars #each in a Play Scala View

If you’re using Play Scala views with Handlebars in them, and you get errors that look like these: not found: value key In /home/phil/myproject/app/views/myview.scala.html at line 108. or not found: value index In /home/phil/myproject/app/views/myview.scala.html at line 108. It’s probably because you’re using {{@index}} when iterating through an array with {{#each myarray}} or {{@key}} when iterating […]

Using a Backbone Model with Handlebars

A Backbone model’s property has to be accessed with the get(property) method. var myObj = Backbone.Model.extend({ … }); //don’t do this console.log(myObj.myProp); //do this instead console.log(myObj.get(‘myProp’)); If you’re trying to pass this object to a Handlebars.js, things start to get messy. If you’ve got a template like this var myTemplate = Handlebars.compile(“Property: {{ myObj.myProp }}”); […]