【发布时间】:2017-08-10 04:34:18
【问题描述】:
我有一个包含主页和详细信息页面的两页 Web 服务。当我双击主页数据时,我可以直接进入详细信息页面并填充详细信息。但是,当我按“F5”刷新页面时,总是得到“错误 404:未找到”。我试过使用'useHash:true'但仍然没有运气。有人可以请教吗?
我的 app-routing.module.ts 在下面;
const routes: Routes = [
{path: '', redirectTo: '/dashboard', pathMatch: 'full'},
{path: 'dashboard', component: DashboardComponent},
{path: 'dashboard/detail', component: DetailComponent},
];
@NgModule({
imports: [RouterModule.forRoot(routes, { useHash: true, enableTracing: true })],
exports: [RouterModule]
})
export class AppRoutingModule {
}
我的主页双击功能直接进入详情页:
onRowDoubleClick(event) {
this.routerService.navigate(["dashboard/detail"]);
}
进入详细信息页面后,如果我从“F5”或 URL 刷新,我会收到以下错误;
【问题讨论】:
标签: angular http http-status-code-404 refresh angular2-routing