Simple Backbone.ModelBinding Example
shows how simple modelbinding can be with the Backbone.ModelBinding plugin from http://github.com/derickbailey/backbone.modelbinding
HTML
<script src="https://raw.github.com/documentcloud/underscore/1.1.7/underscore.js"></script>
<script src="https://raw.github.com/douglascrockford/JSON-js/master/json2.js"></script>
<script src="https://raw.github.com/documentcloud/backbone/0.5.3/backbone.js"></script>
<script src="https://raw.github.com/derickbailey/backbone.modelbinding/v0.2.1/backbone.modelbinding.js"></script>
<div class="contentName"></div>
JavaScript
var showNameView = Backbone.View.extend({
el:'.contentName',
initialize: function(){
this.render(this.options.name);
},
render: function(name){
this.$el.html(name);
}
});
$(document).ready(function(){
var myName1 = new showNameView({name: 'Nishant'});
var myName2 = new showNameView({name: 'Sujit'});
});