angular2 routing - angular 2 passing parameters to named router-outlet? -
i sending parameters through named router-outlet childcomponent
. in child component when try access params undefined.
here route-config file
{ path: 'contact-hold/:id', component: operationcomponent, outlet: 'popup' }
here link:
<a [routerlink]="['\',{outlets:{popup:['hold',1]}}]">hold</a>
here looks in browser:
/contact-list(popup:contact-hold/1)
and here router-outlet have kept in appcomponent
:
<router-outlet name="popup"></router-outlet>
i accessing param in operation component:
this.route.queryparams.subscribe(params=> { console.log(params["id"]); })
i have gone trough other questions in stackoverflow , implemented solution still it's not working. might wrong code?
try :
import { activatedroute } '@angular/router'; routesub: any; constructor( private route: activatedroute ) {} this.routesub = this.route.params.subscribe((params) => { console.log('params', params); })
Comments
Post a Comment