【发布时间】:2019-03-01 16:41:37
【问题描述】:
我使用 MEAN 堆栈创建了一个网页。角 5。
我遇到的一个问题是我无法输入直接 url 路径。例如,如果我最后输入 /home,我会收到此错误消息“无法获取 /home”。当我也点击刷新时会发生这种情况。如果我从主页单击“主页”导航按钮,该页面运行良好。
例如: 这是我的页面:https://nameless-hollows-54410.herokuapp.com/
当我转到直接链接时,https://nameless-hollows-54410.herokuapp.com/home
页面已损坏。为什么会这样?
我的应用路由代码:
const routes: Routes = [
{ path: '', redirectTo: '/home', pathMatch: 'full' },
{ path: 'home', component: HomeComponent},
];
我的导航栏:
<li class="nav-item active">
<a class="nav-link" routerLink="/home">Home
<span class="sr-only">(current)</span>
</a>
</li>
【问题讨论】:
-
这看起来像是您的主机配置有问题,您是否正确配置了重写?
-
什么意思?我不认为我有太大的变化。我遵循了本指南:devcenter.heroku.com/articles/mean-apps-restful-api
标签: node.js angular heroku angular5