3 Kudos

 

Easily bind data with backbone js.

Lately my tinkering and building has led me to use backbone js and coffeescript for a project. I work with Windows Presentation Foundation at my day job, and as far as user interface magic it is very spot on. One of my favorite things is the concept of bindings that refresh whenever the data is displaying it changes, and the good news is that you can simulate this really well using Backbone.js! Checkout this snippet below:

The snippet above simply binds a change event on the datapoint field of your back backbone model. Then it will look in the rendered html of the model, and substitute the current value in the .datapoint field, and substitute the new value of the model’s field. Just remember to use the fat arrow to bind that particular model to that particular event and set of rendered html!