I created some routing in my angular 2 project. This has never been a problem for me in the past, but I am having difficulty with this new version of angular.
If I click links to routes, I have no problem. However, if I go to any route other than my root (/), my application will get stuck on the download screen. Every time I try to go to /loginthrough the url, I am stuck.
corresponding files
app.routes.ts
import { ModuleWithProviders } from '@angular/core';
import { Routes, RouterModule } from '@angular/router';
import { DashboardComponent } from './dashboard/dashboard.component'
import { LoginComponent } from './login/login.component'
import { AuthGuard } from './auth-guard.service'
const appRoutes: Routes = [
{ path: '', component: DashboardComponent},
{ path: 'login', component: LoginComponent },
]
export const appRoutingProviders: any[] = [
];
export const routing: ModuleWithProviders = RouterModule.forRoot(appRoutes)
app.module.ts
@NgModule({
declarations: [
AppComponent,
LoginComponent,
DashboardComponent
],
imports: [
BrowserModule,
FormsModule,
HttpModule,
routing,
StoreModule.provideStore({user})
],
providers: [
AuthGuard,
AuthService,
appRoutingProviders
],
bootstrap: [AppComponent]
})
export class AppModule { }
app.component.html
<div id="header">
<img src="app/assets/img/irs-logo.png" alt="irs">
</div>
<nav>
<a routerLink="/login" routerLinkActive="active">login</a>
<a routerLink="/" routerLinkActive="active">dashboard</a>
</nav>
<div id="body" class="container body">
<router-outlet></router-outlet>
</div>
is there anything else i could skip here?
my components at this stage are pretty empty shells