There are different ways to invoke routes. I currently use Router.navigate( '/url', true ) in my view functions to trigger a route, but it also seems possible to trigger a route with an anchor tag with the url hash as the href attribute.
The way I render a collection to the screen has also something to do with it I guess. I have a global 'index' view that render a new subview for each item from the collection.
render : function() {
var self = this;
$( this.el ).html( _.template( this.template, {} ) );
this.collection.each( function( model ) {
self.addOne( model );
} );
},
addOne : function( model ) {
var project = new TMRS.views.projects.Record( { model : model } );
$( this.el ).append( project.render().el );
},
Within the subview I trigger a route when a specific element is clicked, it works and it is easy as pie. But when I would decide to use anchors with hashes there is nu use for the subview anymore, because I can just iterate over the collections within my templates and handle urls with anchor tags.
I think it is better to use a single view for each record, but I don't know if it is the way to go. What do you guys think?