Answer the question
In order to leave comments, you need to log in
Get parameter from url angular, redirect from Github?
1. I go through the authorization link via Github oauth
2. Then it redirects me to my application localhost:4200/?code=999999999999#/
3. Since I have an angular router configured, without knowing this route, it throws me back to localhost:4200/#/. It happens so fast that I can't get this 'code'.
4. Did the following but writes undefined:
import { ActivatedRoute, Params } from '@angular/router';
this.route.queryParams.subscribe(params => {
this.githubCode = params['code'];
localStorage.setItem('githubCode', this.githubCode);
});
Answer the question
In order to leave comments, you need to log in
you can add such a route
, it should work when the url does not match any of the routes (usually it is used to show 404)
in AnyComponent already read the get-parameter, as you did above
. In this case, there should not be a redirect
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question