Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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

This comment has been minimized.

Copy link

@satlavida satlavida commented Jul 14, 2011

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