I added routing to my angular 2 app to read query parameters from the URL. The URL looks something like www.myapp.com/projectName/myPage.html?query1=firstName
. In my routing code, I have:
import { ModuleWithProviders } from '@angular/core';
import { Routes, RouterModule } from '@angular/router';
import { routingComponent } from './app.adminPage';
// Route Configuration
export const routes: Routes = [
{ path: 'myPage.html', component: routingComponent}
];
export const routing: ModuleWithProviders = RouterModule.forRoot(routes);
My example is very simple, as all I am using routing for is reading query parameters from the page. However, when I hit www.myapp.com/projectName/myPage.html?query1=firstName
and it routes and serves my component, the URL changes to www.myapp.com/projectName/
, which means that if the user refreshes, it loads back to my landing page. I have another page that uses routing to ready query params that doesn't do this, so I am curious as to why this page does that. Is there a way to stop this?