【发布时间】:2020-08-22 11:07:58
【问题描述】:
我的 Angular 项目有问题。在 dev (ng s) 中工作正常,按 F5 键后,页面重新加载正确并且工作正常。
当我构建项目并将其部署到远程服务器时,一切正常,但按 F5 按钮后,页面重新加载并显示错误 404 - 未找到。我做错了什么?
我的路由器模块:
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 { }
谢谢!
【问题讨论】:
标签: angular typescript http-status-code-404 reload