在线观看不卡亚洲电影_亚洲妓女99综合网_91青青青亚洲娱乐在线观看_日韩无码高清综合久久

鍍金池/ 問(wèn)答/HTML5/ angular5設(shè)置了默認(rèn)路由,使用ng build打包后不生效

angular5設(shè)置了默認(rèn)路由,使用ng build打包后不生效

路由配置如下

const routes: Routes = [
  { path: '', redirectTo: '/a', pathMatch: 'full' },
  { path: 'a', component: AComponent },
  { path: 'b', component: BComponent },
  { path: 'c', component: CComponent }
];

使用ng server運(yùn)行良好,但是使用ng build打包后再運(yùn)行,配置的默認(rèn)路由得內(nèi)容就不出來(lái)了,要重新點(diǎn)擊對(duì)應(yīng)的鏈接后才出來(lái)

回答
編輯回答
茍活

try this:

const routes: Routes = [
{ path: '', redirectTo: 'a', pathMatch: 'full' },
{ path: 'a', component: AComponent },
{ path: 'b', component: BComponent },
{ path: 'c', component: CComponent }
];

2018年4月16日 00:44
編輯回答
嘟尛嘴

解決了,是我的url寫錯(cuò)了

2018年8月2日 17:45