簡體   English   中英

Angular 輔助路由在本地工作,但在部署時不起作用

[英]Angular auxiliary routes works locally but not when deployed

我在直接訪問輔助路由時遇到問題。 當我在本地訪問 /home/(post:12) 時,一切正常。 但是,當我嘗試將應用程序部署到 github 頁面時,會出現 Wild 404。

基本上輔助路線是加載彈出模式。

<router-outlet name="post"></router-outlet>

這是路由器模塊:

RouterModule.forRoot([
      {
        path: 'home',
        component: ShellComponent,
        children: [
          {
            path: ':postId',
            component: PostEntryComponent,
            outlet: 'post'
          },
          {
            path: '',
            redirectTo: 'home',
            pathMatch: 'full'
          }
        ]
      },
      {path: '**', redirectTo: 'home'}
    ])

我想讓它像在本地服務器上一樣工作。 有任何想法嗎?

那會有幫助嗎?

// Excerpt app-routing.module.ts

@NgModule({
  imports: [
    RouterModule.forRoot(routes, {
      useHash: true,
    }),
  ],
  exports: [RouterModule],
})

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM