Project going ok so far.. handy tip today is abut using underscore’s where on a collection checking against multiple attributes. e.g. below:
var femaleClubHomeGames = matchesModelView.collection.where({"homeTeam":club, "gender":"womens"});
Also doing a good bit around routing and links to routes.. so for example when the method teamClicked is called I put the buttons href into navigate to kick the router off – that way the router is checking for the URL and taking in the necessary parameters.
Method:
teamClicked: function(e){ event.preventDefault; var myTarget = $(event.target).attr('href'); myRouter.navigate(myTarget, { trigger: true }); //send back to the router to decide what to do return false }
The href thats being pushed through is something like this ‘club/Botanic’ (no ending slash – that caused problems for some reason)
The router is set up to be something like this:
"club/:club": 'club',
And then the router’s method can take that club parameter in from the url to use it however we wish.
club: function(club){ console.log(club);
All good stuff so far, lots done, loads more to do! Onwards and upwards!