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

Popular posts from this blog

javascript - Jquery show_hide, what to add in order to make the page scroll to the bottom of the hidden field once button is clicked -

javascript - Highcharts multi-color line -

javascript - Enter key does not work in search box -