angular5设置了默认路由,使用ng build打包后不生效
路由配置如下
const routes: Routes = [
{ path: '', redirectTo: '/a', pathMatch: 'full' },
{ path: 'a', component: AComponent },
{ path: 'b', component: BComponent },
{ path: 'c', component: CComponent }
];
使用ng server运行良好,但是使用ng build打包后再运行,配置的默认路由得内容就不出来了,要重新点击对应的链接后才出来
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
try this:
const routes: Routes = [
{ path: '', redirectTo: 'a', pathMatch: 'full' },
{ path: 'a', component: AComponent },
{ path: 'b', component: BComponent },
{ path: 'c', component: CComponent }
];
解决了,是我的url写错了