I have two routes with different hashes but the same view model:
var routes = [
{ route: '', moduleId: 'home', title: 'Home', nav: 1 },
{ route: 'details(/:id)', moduleId: 'details', title: 'Details', nav: 2, hash: '#details' },
{ route: 'access_token=*token', moduleId: 'details', title: 'Details', nav: false, hash: "#access_token=" }];
How can I determine the path taken to reach the details view model in the activate
method of the details view model? I attempted to iterate over the router.routes
array and find the route with isActive() == true, however this is not available until the activate method returns a result.
Additionally, if I add the detection of the active route into the binding
method of the view model, both routes appear as active regardless of which one was actually accessed:
function binding() {
router.routes.forEach(function (route) {
console.log('Route ' + route.hash + " isActive:" + route.isActive());
});
}
Console log:
Route # isActive:false details.js:37
Route #details isActive:true details.js:37
Route #access_token= isActive:true