Skip to content

Instantly share code, notes, and snippets.

@fwielstra
Created June 13, 2011 10:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fwielstra/1022573 to your computer and use it in GitHub Desktop.
Save fwielstra/1022573 to your computer and use it in GitHub Desktop.
The same application in Backbone.js
$(function() {
window.ThreadController = Backbone.Controller.extend({
initialize: function() {
this.threadListModel = new ThreadListModel;
this.threadListView = new ThreadListView;
Backbone.history.start();
},
routes: {
"/" : "listThreads"
},
listThreads: function(query) {
this.threadListModel.fetch();
},
});
window.ThreadListView = Backbone.View.extend({
el: $("#main"),
initialize: function(threads) {
_bindAll(this, 'render');
},
render: function() {
$(this.el).html(ich.threadTemplate(this.model.toJSON()));
}
});
window.ThreadListModel = Backbone.Model.extend({
url : 'thread';
});
});
@satlavida
Copy link

on line number 20 it should be "_.bindAll(this, 'render');

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment