我的包裹json有"@angular/router": "3.0.0"
我的应用程序路线:
export const routeConfig: Routes = [
{path: '', redirectTo: 'use-cases', pathMatch: 'full'},
{path: 'use-cases', component: UseCasesComponent},
{path: 'add', component: AddComponent},
{path: 'github', component: RepoBrowserComponent,
children: [
{path: '', component: RepoListComponent},
{path: ':org', component: RepoListComponent,
children: [
{path: '', component: RepoDetailComponent},
{path: ':repo', component: RepoDetailComponent}
]
}]
}
];但是,当我访问我的应用程序时,我仍然得到基于urls的/#/。
发布于 2016-10-27 14:58:38
角在默认情况下使用PathLocationStrategy (没有/#/)。
如果你提供
providers: [{provide: LocationStrategy, useClass: HashLocationStrategy}]在您的代码中,路由器使用/#/。
这通常是因为当使用没有HTML5 pushState支持的服务器时,PathLocationStrategy会导致404错误。如果服务器支持HTML5 pushState,只需删除上面的提供程序。
https://stackoverflow.com/questions/40287721
复制相似问题