angular - Angular2: How to access index.html querystring in App Component -
i new angular2 development.
i have requirment need call angular2 web site asp.net web site. while calling angular2 website (localhost:4200\index.html), pass querystring below localhost:4200\index.html?userid=chandra
now question is.
how userid querystring value app component (i.e. bootstrap compoent) or other component.
please me witht this.
thanks in advance.
the docs pretty decent on if haven't looked @ them. short answer is, access query parameters component, you'll need use activatedroute:
import { activatedroute } '@angular/router'; .... export class mycomponent { constructor( private route: activatedroute, ) { } ngoninit() { this.route.queryparams.subscribe(queryparams => //do queryparams['userid'] ); } } the router hold both route params , query params. treated separately. subscribe queryparams access parameters.
hope helps.
Comments
Post a Comment