私のアプリをプロダクションサーバーのAngularに展開したいのですが、問題があります。アプリケーションは、角度ルーティング(コンポーネントの変更、リダイレクトなし)のみを使用しているが、ブラウザーでページを更新すると、コアページで動作します(IISをWebサーバーとして使用しているIISから404ページが返されます)Angular deployment - 404 on page Refresh
ルーティング:
const appRoutes: Routes = [
{ path: '', redirectTo: '/home', pathMatch: 'full', canActivate: [AuthGuard] },
{ path: 'home', component: DashboardComponent, canActivate: [AuthGuard] },
{ path: "profile", component: UserProfileComponent, canActivate: [AuthGuard] },
{ path: '400', component: ErrorComponent },
{ path: '401', component: ErrorComponent },
{ path: '403', component: ErrorComponent },
{ path: '404', component: ErrorComponent },
{ path: '500', component: ErrorComponent },
{ path: '503', component: ErrorComponent },
{ path: '**', redirectTo: '/404' }
]
いくつかのルートに '[AuthGuard]'が実装されているので、 'providers:[AuthGuard、LoginService]'のように 'app.routing'ファイルで' providers'を使用して 'services'を登録する必要があります。あなたは '[AuthGuard]'のために使います。あなたはそれをやりました? – nivas
経路はrouting.module.tsで定義され、app.moduleで使用するプロバイダはAuthGuardです。 routing.moduleのプロバイダであるか、app.module内のプロバイダのみである必要がありますか? – bluray
@ routingモジュール.module.tsに@NgModuleデコレータで宣言する必要があります – nivas