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

Open
opened 2017-03-29 06:26:35 +00:00 by Gznq · 9 comments
Gznq commented 2017-03-29 06:26:35 +00:00 (Migrated from github.com)

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

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
saidavdic commented 2017-03-29 12:36:23 +00:00 (Migrated from github.com)

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).

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).
daton89 commented 2017-07-01 11:16:51 +00:00 (Migrated from github.com)

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
]

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 ]
AnupKumarGupta commented 2017-07-03 10:08:37 +00:00 (Migrated from github.com)

@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
@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 ```
daton89 commented 2017-07-03 13:09:18 +00:00 (Migrated from github.com)

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

@AnupKumarGupta can you show me your app.module.ts code?
AnupKumarGupta commented 2017-07-03 13:11:52 +00:00 (Migrated from github.com)

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

@daton89 I just removed the directive from `declarations`. I didn't add them to`imports` It worked. Thanks 👍
spnm commented 2017-11-28 15:49:01 +00:00 (Migrated from github.com)

same issue here.

same issue here.
armando0594 commented 2018-02-27 21:00:40 +00:00 (Migrated from github.com)

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

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
daton89 commented 2018-03-16 11:42:03 +00:00 (Migrated from github.com)

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

@armando0594 i don't understand your question, please can you explain what are you asking me?
ApuPradhan commented 2020-10-07 14:43:05 +00:00 (Migrated from github.com)

thanks

thanks
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: dc/ng2-file-upload#706