ng2-file-upload
ng2-file-upload copied to clipboard
ERROR in Type FileSelectDirective is part of the declarations of 2 modules:
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
The directive can be declared in just one Module.
-
create shared.module.ts @NgModule({ declarations: [ FileSelectDirective, FileDropDirective ], imports: [
], exports: [ FileSelectDirective, FileDropDirective ] }) export class SharedModule { }
-
Add SharedModule to import list in both (FileUploadModule and SystemModule).
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 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 can you show me your app.module.ts code?
@daton89 I just removed the directive from declarations
. I didn't add them toimports
It worked.
Thanks 👍
same issue here.
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 i don't understand your question, please can you explain what are you asking me?
thanks