Tag Archives: javascript

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 }}”); […]