Closed andershagebakken closed 7 years ago
Duplicate of #89 - closing for now and leaving that thread open - will try to fix for 0.8
Hi, thanks for this excellent cropper. The issue here does not seem to be fixed in 0.8, I still get the same. Any chance to get it fixed ? Thanks a lot !
The exact and full error message is : ERROR in Type ImageCropperComponent in ./node_modules/ng2-img-cropper/src/imageCropperComponent.ts is part of the declarations of 2 modules: ImageCropperModule in ./node_modules/ng2-img-cropper/src/imageCropperModule.ts and AppModule in /home/kmoyse/akgsworkspace/BookingDatabase/frontend/src/app/app.module.ts! Please consider moving ImageCropperComponent in ./node_modules/ng2-img-cropper/src/imageCropperComponent.ts to a higher module that imports ImageCropperModule in ./node_modules/ng2-img-cropper/src/imageCropperModule.ts and AppModule in ./src/app/app.module.ts. You can also create a new NgModule that exports and includes ImageCropperComponent in ./node_modules/ng2-img-cropper/src/imageCropperComponent.ts then import that NgModule in ImageCropperModule in /./node_modules/ng2-img-cropper/src/imageCropperModule.ts and AppModule in ./src/app/app.module.ts.
EDIT : wait a bit, I'm looking at your code, and I think you did it right... maybe I should rework the way I'm using it.. keep you posted...
EDIT2 : Yeah, my bad ... I changed :
//import { ImageCropperComponent, CropperSettings } from 'ng2-img-cropper'; to import { ImageCropperModule } from 'ng2-img-cropper';
and then declarations: [ ... //ImageCropperComponent,
to
imports: [
... ImageCropperModule,
And it now works fine !!
Thanks again for this awesome component !
can this be closed?
Yes you can closed it now ;) sorry for the noise !
thanks! no worries
Just to confirm for anyone else visiting this issue thread that the solution/explanation provided by @andershagebakken works 100%. Click to scroll to the comment.
@cstefanache Can you just provide the right code for module and component so ng build --prod
would work properly? As I saw in your img-cropper docs https://github.com/cstefanache/angular2-img-cropper we can't use declarations in Component. It's really confusing to see all different answers all over github and stackoverflow. Thanks for your efforts.
This repo is deprecated.
use this one for any further issues and please make noise to let the world know about that new name. https://github.com/web-dave/ngx-img-cropper
here is my showcase wich works with ng build --prod https://github.com/web-dave/ngx-img-cropper-showcase
Hi. Great work on the cropper.
I just have a question. I am using angular-cli, and when I am trying to run
ng build --prod --aot
I get the following error:Type ImageCropperComponent is part of the declarations of 2 modules: ImageCropperModule and AppModule! Please consider moving ImageCropperComponent to a higher module that imports ImageCropperModule and AppModule. You can also create a new NgModule that exports and includes ImageCropperComponent then import that NgModule in ImageCropperModule and AppModule.
It works very well without the aot-flag, so is there any way to solve this? Thanks. :-)