Reputation: 735
This is part of my app NgModule:
@NgModule({
imports: [
RouterModule.forRoot([
{ path: '', component: testComponent },
{ path: 'test', component: anotherTestComponent }
], { useHash: true })
That is the only place where i declare my routing.
I'm encountering this problem: starting from root (/#/
) i go first to "test" (/#/test
) and then move back to root.
Here, if i click enter on address bar (with the root path), my whole app is reloaded. I get the same if i go to "test" first and then re-enter the "test" path on the address bar.
I didn't test router-link within my app.
Upvotes: 0
Views: 1997
Reputation: 4524
This is how the browser works, when you hit enter on the address bar it triggers a page refresh.
To navigate through a Single Page App you use routes/links inside the app, not hitting enter on the address bar.
Upvotes: 1