I am trying to instantiate a model in a backbone.js router which I have included through require.js. However, I keep getting the following error;
Uncaught TypeError: object is not a function
Here is the model;
define(['jquery', 'underscore', 'backbone'], function($, _, Backbone) {
var AppState = Backbone.View.extend({});
return AppState;
});
And here is the router where I am trying the instantiate the model.
define(['jquery', 'underscore', 'backbone', 'models/appstate'],
function($, _, Backbone, AppState) {
var Router = Backbone.Router.extend({
routes: {
'': 'index'
},
index: function() {
var appState = new AppState();
}
});
return new Router();
});
The model file is being included and all paths are correct.
Have your model extend model instead of view.