xieziyu / angular2-draggable

Angular directive (for version >= 2.x ) that makes the DOM element draggable and resizable
https://xieziyu.github.io/angular2-draggable/
294 stars 103 forks source link

angular2-draggable doesn't work in lazy loaded modules #120

Open uberspeck opened 5 years ago

uberspeck commented 5 years ago

I can't get it to work in lazy loaded modules.

https://stackblitz.com/edit/ngdraggable-lazy-load

xieziyu commented 5 years ago

@uberspeck You need to import AngularDraggableModule in your lazy.module.ts:

import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { RouterModule, Routes } from '@angular/router';
+ import { AngularDraggableModule } from 'angular2-draggable';
import { LazyComponent } from './lazy.component'

const routes: Routes = [
  {
    path: '',
    component: LazyComponent
  }
];

@NgModule({
  imports: [
    CommonModule,
+   AngularDraggableModule,
    RouterModule.forChild(routes),
  ],
  declarations: [LazyComponent]
})
export class LazyModule { }