Here is the URL that I want to handle http://localhost/?id=120&lang=en&search=abc
How can I read these parameters (id, lang and search).
Here is the URL that I want to handle http://localhost/?id=120&lang=en&search=abc
How can I read these parameters (id, lang and search).
You have to use ActivatedRoute from @angular/router, just like any other parameters, no difference with a not-optionnal one.
more info at : https://angular.io/docs/ts/latest/guide/router.html#!#optional-route-parameters
export class HeroComponent implements OnInit {
constructor(private _activatedRoute: ActivatedRoute, private _router:Router) {
_router.routerState.queryParams.subscribe(
data => console.log('queryParams', data['st']));
See also Get route query params