cstefanache / angular2-img-cropper

Angular 2 Image Cropper
MIT License
364 stars 135 forks source link

imageCropperComponent.ts is part of the declarations of 2 modules #152

Closed gabrielrojasp closed 7 years ago

gabrielrojasp commented 7 years ago

Hi,

Can you help me?. I had similar problem when try ng build --prod

I had in module implement

import {ImageCropperComponent, CropperSettings, Bounds } from 'ng2-img-cropper';

@Component({ selector: 'app-user-promotion-create-edit', templateUrl: './user-promotion-create-edit.component.html', styleUrls: ['./user-promotion-create-edit.component.css'], providers: [CommerceService, CategoriesService, PromotionService], animations: [moveIn(), fallIn(), moveInLeft()], host: {'[@moveIn]': ''} }) export class UserPromotionCreateEditComponent implements OnInit, AfterViewChecked { @ViewChild('cropper', undefined) cropper: ImageCropperComponent;

// IMAGE public data: any; public name: string; public cropperSettings: CropperSettings;

==============================================

in shared module had:

import {ImageCropperComponent} from 'ng2-img-cropper'; @NgModule({ imports:[ CommonModule, RouterModule, ReactiveFormsModule, // ImageCropperComponent, AgmCoreModule.forRoot({ apiKey: 'xxxxxxxxx' }), LocalStorageModule.withConfig({ prefix: 'name', storageType: 'localStorage' }) ], declarations: [

  ImageCropperComponent,

], exports:[

  ImageCropperComponent,

],

this works fine, but the problem is when try to ng build --prod

Sorry, my english is not good

I appreciate any advice!

cstefanache commented 7 years ago

Please check #126 - let me know if the solution work for you.

gabrielrojasp commented 7 years ago

Thanks! ... yes it works

In my case in SharedModule

import {ImageCropperModule} from 'ng2-img-cropper/index';

@NgModule({ imports:[ ImageCropperModule, ], declarations: [

], exports:[ ImageCropperModule, ] }) export class SharedModule { }

After this, it works well

Regards

cstefanache commented 7 years ago

Fixed in 0.8.4 < added exports into the module

terravibe commented 6 years ago

(Api keys should be hidden
AgmCoreModule.forRoot({ apiKey: 'xxx' }),) @kinoxhio

gabrielrojasp commented 6 years ago

@terravibe thanks !!

vikramkalta commented 6 years ago

how would u hide the api keys?

gabrielrojasp commented 6 years ago

@vikramkalta I wrote in the example

vikramkalta commented 6 years ago

@kinoxhio thanks man

vikramkalta commented 6 years ago

in my case the issue was silly, i was declaring ImageCropperComponent in more than 2 places, where as I should have just imported ImageCropperModule wherever I am using it. (just started exploring power of angular)