【发布时间】:2019-09-08 17:24:56
【问题描述】:
当它在 Angular 7 上出现时,我切换到延迟加载功能,在此之前,cdk 拖放可以工作,现在它坏了。
我在代码中使用了一些共享模块来集中模块,例如,每当我需要模块 A,B,C 时,我只导入模块 D,它本身会导入这些模块。
我尝试导入位于 @angular/cdk/drag-drop 的 DragDropModule 在这些共享模块之一中,它不起作用。
我还仔细检查了这些模块是否被导入到任何地方。
请注意,我确保共享模块也已导出。
共享模块
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import {DragDropModule} from '@angular/cdk/drag-drop';
@NgModule({
declarations: [],
imports: [DragDropModule, CommonModule],
exports : [DragDropModule]
})
export class DragDropSharedModule {}
在其他共享模块中
import {DragDropSharedModule} from './core-shared/drag-drop.module'
@NgModule({
declarations: [
NavbarComponent,
AppComponent,
// TimeAgoPipe,
RmSetTextComponent,
// ToggleComponent,
KeysPipe,
TimeAgoPipe
// LoadingComponent
////////////// AclControlComponent,
///////////// AclGroupListComponent,
////////////////////// AclPermissionComponent,
///////////// SelectedItemsPipe
],
imports: [
// BrowserModule,
ReactiveFormsModule,
FormsModule,
Ng2FileInputModule.forRoot(),
Ng2ImgFallbackModule,
CommonModule,
HttpClientModule,
// DragDropModule,
ScrollingModule,
NotFountPageModule,
RmTableModule,
ToggleModule,
DragDropSharedModule
]
【问题讨论】:
标签: angular typescript lazy-loading angular-cdk angular-dragdrop