I am new to Backbone.js. For experimenting / initial development, I had everything on one page in the tag, but I started separating out the code into a separate .js file. After I did that I get an error coming from the Router.
Uncaught TypeError: Object [object Object] has no method 'apply'
Here is my Router code:
var AppRouter = new Backbone.Router.extend({
routes: {
":uuid": "details"
},
details: function (uuid) {
// load details
new DetailView({id: uuid, el: $('#detailView')});
}
});
var appRouter = new AppRouter;
I have the Models/Views loaded in a file tag above, but even if I comment out the file's tag or empty the file, it still displays thing error.
The line throwing the error is var appRouter = new AppRouter;
I'm I doing something wrong with the router code.
Thanks!! Andrew
Remove the new
in var AppRouter = new Backbone.Router.extend({...
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With