में आलसी लोड मार्गों के लिए काम नहीं कर रहा रीडायरेक्ट मैं एक ऐप्लिकेशन है जो एक प्रमाणीकृत धारा (InternalRootComponent) और एक गुमनाम धारा (ExternalRootComponent) में बांटा गया है है।डिफ़ॉल्ट मार्ग कोणीय 2
सब कुछ ठीक काम करता है जब मैं स्पष्ट रूप से मार्गों पर नेविगेट, लेकिन जब मैं जड़ (/) में जाओ, मैं रीडायरेक्ट नहीं होते हैं। साथ ही, कुछ कारणों से accountsComponent लोड किया गया है।
एप्लिकेशन-routing.module.ts:
export const routes: Routes = [
{
path: '',
redirectTo: 'login',
pathMatch: 'full'
},
{
path: 'login',
component: ExternalRootComponent,
children: [
{
path: '',
loadChildren: './login/login.module#LoginModule'
}
]
},
{
path: 'membership',
component: ExternalRootComponent,
children: [
{
path: '',
loadChildren: './membership/membership.module#MembershipModule'
}
]
},
{
path: 'app',
component: InternalRootComponent,
canActivate: [AuthGuard],
children: [
{
path: '',
canActivateChild: [AuthGuard],
children: [
{
path: '',
redirectTo: './dashboard',
pathMatch: 'full'
},
{
path: 'dashboard',
loadChildren: './dashboard/dashboard.module#DashboardModule'
},
{
path: 'accounts',
loadChildren: './accounts/accounts.module#AccountsModule'
},
{
path: 'users',
loadChildren: './users/users.module#UsersModule'
},
{
path: 'services',
loadChildren: './services/services.module#ServicesModule'
},
{
path: 'support',
loadChildren: './support/support.module#SupportModule'
}
]
}
]
},
{
path: '**',
component: NotFoundComponent
}
];
खातों-routing.module.ts:
const routes: Routes = [
{
path: '',
component: AccountInfoComponent
}
];
@NgModule({
imports: [RouterModule.forChild(routes)],
exports: [RouterModule]
})
export class AccountsRoutingModule {}
क्या मुझे समझ नहीं आता है क्यों पहले रीडायरेक्ट काम नहीं करता है - मैं/लॉगिन करने के लिए रीडायरेक्ट/उम्मीद करूँगा। इसके बजाए, ऐसा लगता है जैसे खातों में खाली मार्ग-routing.module.ts का आह्वान किया जा रहा है।
क्या आप app.module.ts में आयात कर रहे हैं या जो कुछ भी फ़ाइल का नाम है कि एप्लिकेशन-routing.module.ts आयात कर रहा है? – brando