Skip to content

Instantly share code, notes, and snippets.

@sumitngupta
Created October 17, 2011 19:54
Show Gist options
  • Select an option

  • Save sumitngupta/1293608 to your computer and use it in GitHub Desktop.

Select an option

Save sumitngupta/1293608 to your computer and use it in GitHub Desktop.
var Projects = Backbone.Collection.extend({
model : Project,
url : '/projects'
});
var Project = Backbone.Model.extend({
urlRoot : '/projects/:id'
});
# these routes are going to enable:
# myapp.com/whateverisloadingbackbone# --> index
# myapp.com/whateverisloadingbackbone#:ID --> show
# so if you have the backbone enabled page loading off myapp.com/projects backbone is going to look at everything after that after a pound symbol (like you're seeing).
ThresholdBackbone.Routers.Projects = Backbone.Router.extend({
routes: {
'' : 'index',
':id' : 'show'
},
index: function() {
console.log("Index View!");
},
show: function() {
console.log("Show View!");
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment