路由配置如下
const routes: Routes = [
{ path: '', redirectTo: '/a', pathMatch: 'full' },
{ path: 'a', component: AComponent },
{ path: 'b', component: BComponent },
{ path: 'c', component: CComponent }
];
使用ng server运行良好,但是使用ng build打包后再运行,配置的默认路由得内容就不出来了,要重新点击对应的链接后才出来
try this:
const routes: Routes = [
{ path: '', redirectTo: 'a', pathMatch: 'full' },
{ path: 'a', component: AComponent },
{ path: 'b', component: BComponent },
{ path: 'c', component: CComponent }
];