Be careful with your routes. A "redirectTo" will remove|drop any query parameter.
const appRoutes: Routes [
{path: "one", component: PageOneComponent},
{path: "two", component: PageTwoComponent},
{path: "", redirectTo: "/one", pathMatch: full},
{path: "**", redirectTo: "/two"}
]
I called my main component with query parameters like "/main?param1=a¶m2=b and assume that my query parameters arrive in the "ngOnInit()" method in the main component before the redirect forwarding takes effect.
But this is wrong. The redirect will came before, drop the query parameters away and call the ngOnInit() method in the main component without query parameters.
I changed the third line of my routes to
{path: "", component: PageOneComponent},
and now my query parameters are accessible in the main components ngOnInit and also in the PageOneComponent.