Created
October 17, 2011 19:54
-
-
Save sumitngupta/1293608 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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