I am separating my views and router into separate files with require. I then have a main.js file that instantiates the router, and also renders my default view.
My r
I know this question is old, but I am wondering why haven't you use require.js in order to get the router:
define(['./PathToRouter', ], function (router) {
return Backbone.View.extend({
template: Handlebars.compile($('#template').html()),
events: {
'click .edit': 'edit'
},
render: function () {
//Create and insert the cover letter view
$(this.el).html(this.template(this.model.toJSON()));
$('#View').html(this.el);
return this;
},
edit: function () {
router.navigate('Edit/' + this.model.id, true);
}
});
});