Skip to content

Instantly share code, notes, and snippets.

@julesbou
Created March 11, 2016 15:40
Show Gist options
  • Save julesbou/28bbda321bd2b0bee341 to your computer and use it in GitHub Desktop.
Save julesbou/28bbda321bd2b0bee341 to your computer and use it in GitHub Desktop.
var View = Backbone.View.extend({
tagName: 'div',
initialize: function() {
this.model.on('change:name', function(model, name) {
console.log('name is now: ' + name);
});
},
render: function() {
this.$el.html(
'<h1>'+this.model.get(‘name’)+'</h1>' +
'<a href=”#load/'+this.model.get('index')+1+'”>next</a>'
);
return this;
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment