I have problem with my angular project. In dev (ng s) is working normally and after pressing F5 key, page reload correctly and working fine.
When I build and deploy project to remote server, everything is working fine, but after pressing F5 button, page reloads and show error 404 - not found. What I am doing wrong?
My router module:
const routes: Routes = [
// hlavní cesty routingu
{ path: "login", component: LoginComponent },
{ path: "registration", component: RegisterComponent },
{ path: "resetPassword", component: ResetPasswordComponent },
{ path: "resetPasswordNew", component: InsertNewPasswordComponent },
{path: "system",
component: MainComponentComponent,
canActivate: [AuthGuard], // Auth guard mi vrací true nebo false podle toho, zda už mám načtený token nebo ne
children: [
{ path: 'dashboard', component: DashboardComponent, canActivate: [RoleGuardService]}, //RoleGuardService mi hlídá, zda je lognutý žák nebo učitel
{ path: 'baterie' , component: BaterieComponent},
{ path: 'settings' , component: SettingsComponent,
children: [
{path: 'info' , component: InfoComponent, canActivate: [RoleGuardService]}
]
},
{ path: '', redirectTo: 'dashboard', pathMatch: 'full', },
]
},
{ path: '', redirectTo: 'login', pathMatch: 'full', },
];
@NgModule({
imports: [RouterModule.forRoot(routes)],
exports: [RouterModule]
})
export class AppRoutingModule { }
Thank you!