[英]Angular 8 - routing works locally, but when deployed on Production, routes don't work - .NET Core C# backend
[英]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.