nested - Child URL Query params shown with ; instead of & -


i creating nested route , when trying access link params , query child routes shown http://localhost:3000/test/test/testingid;param1=value1 instead of http://localhost:3000/test/test/testingid?param1=value1

here parent route definitions:

@routeconfig([   {path: '/', component: rootcomponent, name: 'rootcmp' },   {path: '/test/...', component: nestedcomponent, name: 'nestcmp', data: {isadmin: true} } ])  @component({   selector: 'main-app',   template:`        <h1>using router , router config</h1>       <a [routerlink]="['rootcmp']">home</a> |        <a [routerlink]="['nestcmp']">nested route test</a>      <router-outlet></router-outlet>   `,   directives: [router_directives, routerlink] }) 

my child route definitions this:

@routeconfig([   {path: '/', component: seccomponent, name: 'nestcmp', useasdefault:true },   {path: '/test/:id', component: seccomponent, name: 'nestchildcmp', data: {isadmin: true} }, ])  @component({   selector: 'child-app',   template:`        <h1>using router , router config</h1>       <a [routerlink]="['./nestcmp', {'param1': 'value1'}]">nested home</a> |       <a [routerlink]="['nestchildcmp', { 'id': 'testingid', 'param1': 'value1'}]">nested route test</a>      <router-outlet></router-outlet>   `,   directives: [router_directives, routerlink] }) 

param1 not defined in path using in @routeconfig. assuming optional parameter , final url getting following code be.

http://localhost:3000/test/test/testingid

or

http://localhost:3000/test/test/testingid/value1

try in child component

@routeconfig([   {path: '/', component: seccomponent, name: 'childcmp', useasdefault:true },   {path: '/test/:id', component: seccomponent, name: 'nestchildcmp1', data: {isadmin: true} },   {path: '/test/:id/:param1', component: seccomponent, name: 'nestchildcmp2', data: {isadmin: true} }, ])  @component({    selector: 'main-app',    template:`       <h1>using router , router config</h1>      <a [routerlink]="['./nestcmp', 'nestchildcmp1', {'id': 'testingid'}]">nested home</a> |      <a [routerlink]="['./nestcmp', 'nestchildcmp2', { 'id': 'testingid', 'param1': 'value1'}]">nested route test</a>       <router-outlet></router-outlet>     `,     directives: [router_directives, routerlink]   }) 

also keep different name of different routes, example nestcmp name of both parent , child route in code.


Comments

Popular posts from this blog

c# - How Configure Devart dotConnect for SQLite Code First? -

c++ - Clear the memory after returning a vector in a function -

erlang - Saving a digraph to mnesia is hindered because of its side-effects -