I need some help in accessing query string from index.html in Angular2 component. I have followed this link but it did not work for me link
my index.html
<!doctype html>
<html>
<head>
<base href="/">
<!-- css importd -->
</head>
<body>
<app-root>Loading .. </app-root>
</body>
</html>
app.component.ts
...
public constructor(private activatedRoute:ActivateRoute) {}
ngOnInit() {
this.activateRoute.queryParams.subscribe((params:Params) => {
console.log(params['code']);
});
}
And I am invoking url http://localhost:8080/?code=test