【发布时间】:2018-11-13 12:53:09
【问题描述】:
我在这里遇到了一个独特的路由问题,我有一个 Angular 应用程序在我的本地运行良好,但是当应用程序部署到云代工厂时,路由根本不起作用(它给出 404)。
这里是路由的代码sn-p
import { LocationStrategy, PathLocationStrategy } from '@angular/common';
const appRoutes: Routes = [{
path: '',
component: PageNotFoundComponent
},
{
path: 'contents',
component: ContentsComponent
},
{
path: 'sidebar',
component: SidebarComponent
}
];
我正在寻找这些:
路由条件:
- 没有散列的路由。
- 直接向浏览器输入 URL 应导航到该页面。
- 不应显示 404 错误。
有什么建议吗?
【问题讨论】:
-
您可能只需要在静态文件 buildpack 中启用 pushstate 路由。看这里->stackoverflow.com/questions/42465155/…
标签: angular angular-ui-router angular-routing cloud-foundry