当它出现在 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
]