I am trying to capture the querystring parameter using Angular 2.0 and it is hard for me. I have such a url
http: // localhost: 5000 /? id_token = eyJ0eXAiO ....
And I want to be able to capture the id_token value before the routing holds, and I lose the parameter. I found this GitHub Issue Thread topic.
https://github.com/angular/angular/issues/9451
But it uses an obsolete method that no longer works. I tried the following methods
var foo = this.activatedRoute.queryParams.subscribe(params => { console.log(params); let id = params['id_token']; console.log(id); }); console.log(this.router.routerState.snapshot.root.queryParams["id_token"]); var bar = this.activatedRoute.params.subscribe( (param: any) => console.log(param['id_token']));
I tried these methods in the constructor as well as ngOnInit () of my component, but the console always displays undefined. I do it in the wrong place. I cannot change QS at all because it is created by Azure AD.
source share