ng2-file-upload icon indicating copy to clipboard operation
ng2-file-upload copied to clipboard

ERROR in Type FileSelectDirective is part of the declarations of 2 modules:

Open Gznq opened this issue 7 years ago • 9 comments

I use "ng build - prod - aot" appeared a mistake: ERROR in Type FileSelectDirective is part of the declarations of 2 modules: FileUploadModule and SystemModule,Please consider moving FileSelectDirective to a higher module that imports FileUploadModule and SystemModule You can also create a new NgModule that exports and includes FileSelectDirective then import that NgModule in FileUploadModule and SystemModule

Gznq avatar Mar 29 '17 06:03 Gznq

The directive can be declared in just one Module.

  1. create shared.module.ts @NgModule({ declarations: [ FileSelectDirective, FileDropDirective ], imports: [

    ], exports: [ FileSelectDirective, FileDropDirective ] }) export class SharedModule { }

  2. Add SharedModule to import list in both (FileUploadModule and SystemModule).

saidavdic avatar Mar 29 '17 12:03 saidavdic

you need to import the FileUploadModule in the SystemModule instead of delcare the directives

// SystemModule.js @NgModule({ declarations: [ ... // remove directives ], imports: [ ... // add FileUploadModule here FileUploadModule ]

daton89 avatar Jul 01 '17 11:07 daton89

@daton89 It throws following error :

Unexpected directive 'FileSelectDirective in E:/WebP/node_modules/ng2-file-upload/file-upload/fileselect.directive.d.ts' imported by the module 'AppModule in E:/WebP/src/app/app.module.ts'. Please add a @NgModule annotation

AnupKumarGupta avatar Jul 03 '17 10:07 AnupKumarGupta

@AnupKumarGupta can you show me your app.module.ts code?

daton89 avatar Jul 03 '17 13:07 daton89

@daton89 I just removed the directive from declarations. I didn't add them toimports It worked.
Thanks 👍

AnupKumarGupta avatar Jul 03 '17 13:07 AnupKumarGupta

same issue here.

spnm avatar Nov 28 '17 15:11 spnm

because in another project that I have, do the pages in statements and in components? Could you solve that question? Greetings, friend, your answer helped me a lot in another project. @daton89

armando0594 avatar Feb 27 '18 21:02 armando0594

@armando0594 i don't understand your question, please can you explain what are you asking me?

daton89 avatar Mar 16 '18 11:03 daton89

thanks

ApuPradhan avatar Oct 07 '20 14:10 ApuPradhan