I’m very new to backbone but I manage to get it working from tutorial. But when I want to port those application to the backbone boilerplate I find myself stuck at the template. How do I access my model from my template? or even from the js file itself? I find myself stuck here for awhile now.
Backbone Boilerplate refers to https://github.com/tbranyen/backbone-boilerplate
For most javascript templating libraries, templating occurs in two phases.
.
This is the same basic idea for underscore templates, JST, jade, and most other templating engines. The “context data” is how your template gets access to your model. If you want, you can give it direct access to the underlying model by providing a context like:
{model: myModel};. Then in your template you could do something like<%= model.get("displayName") %>.