jQuery UI Widgets Forums Angular How to include jqxgrid two different modules.

This topic contains 1 reply, has 2 voices, and was last updated by  Stanislav 6 years, 1 month ago.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author

  • Bhavin
    Participant

    I have imported,

    import { jqxGridComponent } from 'jqwidgets-scripts/jqwidgets-ts/angular_jqxgrid'; in every module and I’m importing jqxGridComponent in declarations.

    @NgModule({
    imports: [
    EventLogRoutingModule,
    ChartsModule,
    BsDropdownModule
    ],
    declarations: [ EventLogComponent,jqxGridComponent]
    })

    It’s perfectly working in single component. But when I’m importing it in another module it’s showing me error.

    Error: Type jqxGridComponent is part of the declarations of 2 modules: AppModule and EventLogModule! Please consider moving jqxGridComponent to a higher module that imports AppModule and EventLogModule

    I’m not importing jqxGrid in app component because some how it’s not working.

    So, I’m not able to import jqxgrid on two different modules. In one component it’s perfectly working.

    • This topic was modified 6 years, 1 month ago by  Bhavin.

    Stanislav
    Participant

    Hello Bhavin,

    This is how angular is.
    You can’t import the same component twice.
    You can import it in a “shared” module, and import that module when you need it.

    Example:
    Let’s say you want multiple grids in your application.
    You can import the grid in a separate module, that contains only that component(jqxGridComponent).
    And where ever you have a grid, you just import that exact module.
    This way you have imported the GridComponent once, but you can use it multiple times in your application.

    For more information you can take a look here: Link

    If you have any more questions or need help with this, we are here to help!

    Best Regards,
    Stanislav

    jQWidgets Team
    http://www.jqwidgets.com/

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.