routing - Distinguish the parameter passed as a query string in hot towel template that uses durandal -
i have hot towel application uses durandal routing. 1 of routes defined in config file looks follows:
{ url: 'charts/:id', moduleid: 'viewmodels/charts', name: 'charts', visible: false }
charts viewmodel displays data patient id or agency id. patient viewmodel sending patient id , agency viewmodel sending agency id.
my question how can know in activate method of charts viewmodel whether parameter in url patient id or agency id ?
vm.activate = function (routedata) { ////routedata have routedata.id. how can know if patient id or agency id ? };
to achieve described scenario, easiest thing add second parameter distinguish calling type.
here sample route:
{ url: 'charts/:type/:id', moduleid: 'viewmodels/charts', name: 'charts', visible: false }
in activate should have 2 parameters check against
vm.activate = function (routedata) { ////routedata.type, routedata.id if(routedata.type === "agency") { } };
Comments
Post a Comment