小编bom*_*lue的帖子

Angular 2 路由无法使用 Apache 刷新页面

使用带有更新的@angular/router 的 Angular 2 RC 4,我使用此问题中的答案在浏览器中显示了路由 URL

但是,当我刷新或直接请求使用非默认路由的页面时,它会将我带到默认页面(就像我请求 index.html 一样)而不是我想要的路由页面。如何使用 Apache 2.4 在页面刷新时使 Angular 2 路由正常工作?

路由和引导程序:

const routes: RouterConfig = [
{ path: '', redirectTo: 'dashboardTab', terminal: true },
{ path: 'dashboardTab', component: DashboardComponent },
{ path: 'missionTab', component: MissionComponent, children: childRoutes }];

bootstrap(NavbarComponent, [disableDeprecatedForms(), provideForms(),   provideRouter(routes), {provide: Window, useValue: window}, HTTP_PROVIDERS, ResponsiveState, {provide: PLATFORM_DIRECTIVES, useValue: RESPONSIVE_DIRECTIVES, multi: true}]).catch((err: any) => console.error(err));
Run Code Online (Sandbox Code Playgroud)

index.html 中的基本 href: <base href="/">

apache angular2-routing angular

4
推荐指数
1
解决办法
4876
查看次数

标签 统计

angular ×1

angular2-routing ×1

apache ×1