loadChildrenのContactまたはSupportモジュールでDropSelectComponent共有コンポーネントを動作させることができません。それは熱心な、または怠惰な読み込みでは機能しません。 DropSelectコンポーネントはサービスモジュールの一部であり、Protected Module - layoutcomponentで正常にロードされます。お知らせ下さい?角度4賢明または遅延ロード - SharedModuleが動作しない
Protected.routes.ts
const protectedRoutes: Routes = [
{
path: 'protected',
component: LayoutComponent,
canActivate: [AuthGuard],
children:[
{ path:'', redirectTo: 'contact', pathMatch:'full'},
{ path:'support', loadChildren:() => SupportModule},
{ path:'contact', loadChildren:() => ContactModule},
// { path:'support', loadChildren:'./support/support.module#SupportModule'},
// { path:'contact', loadChildren:'./support/contact.module#ContactModule'},
]
}
];
@NgModule({
imports: [RouterModule.forRoot(protectedRoutes)],
exports: [RouterModule]
})
export class ProtectedRouteModule { }
Protected.module.ts
@NgModule({
imports: [BasicModule, ServicesModule, ProtectedRouteModule],
exports: [],
schemas: [CUSTOM_ELEMENTS_SCHEMA],
declarations: [
LayoutComponent
],
providers: [LayoutService],
})
export class ProtectedModule { }
Support.module
import { NgModule, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
import { CommonModule } from '@angular/common';
import { DashboardComponent } from './dashboard/dashboard.component';
import { DashboardCardsComponent } from './dashboard/dashboard-cards.component';
import { DashboardTableComponent } from './dashboard/dashboard-table.component';
import { SupportRouteModule } from './support.routes';
@NgModule({
imports: [SupportRouteModule],
declarations: [
DashboardComponent, DashboardCardsComponent, DashboardTableComponent
],
exports: [],
schemas: [CUSTOM_ELEMENTS_SCHEMA],
providers: [],
})
export class SupportModule { }
サポートルート
const routes: Routes = [
{ path:'', redirectTo: 'dashboard', pathMatch:'full'},
{
path: 'dashboard', component: DashboardComponent, children:[
{ path: '', component: DashboardCardsComponent},
{ path: 'table', component: DashboardTableComponent},
]
}
];
@NgModule({
imports: [RouterModule.forChild(routes)],
exports: [RouterModule]
})
export class SupportRouteModule { }
サービスモジュール
@NgModule({
imports: [CommonModule, HttpModule, FormsModule, RouterModule, MyDatePickerModule],
declarations: [LoaderComponent, PagerComponent, FullScreenDirective, DashPipe, CutPipe, SearchPipe, DropSelectComponent],
exports: [CommonModule, HttpModule, FormsModule, RouterModule, LoaderComponent, PagerComponent, DashPipe, CutPipe, SearchPipe, DropSelectComponent],
providers: [LoaderService, SessionStorage, LocalStorage, ClockService, StorageService,
{
provide: HttpService,
useFactory: HttpServiceFactory,
deps: [XHRBackend, RequestOptions, Router, LoaderService, StorageService]
},
],
schemas: [CUSTOM_ELEMENTS_SCHEMA],
})
export class ServicesModule { }
は、私がProtectedModuleとSupportModule –
ServicesModuleを共有モジュール投稿することができますされ
–