Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Backbone and Handlebars

mulderp
March 12, 2014

Backbone and Handlebars

A small overview on the MV* pattern with Backbone.js and Handlebars

mulderp

March 12, 2014
Tweet

More Decks by mulderp

Other Decks in Programming

Transcript

  1. MV*

  2. Handlebars� // simple attributes {{title}} // repitition {{#each movies}} <div>{{title}}</div>

    {{/each}} // conditionals {{#if currentUser}} <div>{{ privateStuff }}</div> {{/if}} // customHelpers {{#renderStars 5}}
  3. events� var listView = new Thorax.View({ el: "#movies", events: {

    collection: { reset: function(ev) { // automatic bound } } } }
  4. itemFilter: function (model) { if (active) { return model.get('genre') ===

    active; } else { return true; } } Supports filtering�
  5. |-js! |! |---libs! |-----backbone! |-----impress! |-----masonry! |-----jquery! |-----jquery-fileupload! |-----jquery-ui! |-----require!

    |-----underscore! |! |---modules! |! |! |-templates! |---dashboard! |---directory! |---shared! development production HTTP Loading JS Modules�