Error NG2003: No suitable injection token for parameter 'exportAsService' – ngx-export-as...

Discussão em 'Angular' iniciado por Lojini Loji, Abril 23, 2025.

  1. Lojini Loji

    Lojini Loji Guest

    I'm working on an Angular project and using the ngx-export-as package, which was already installed and working fine in some of my components.

    However, when I tried to use the same ExportAsService in a newly created component (ReportRdComponent), I'm getting the following errors during compilation:

    Error NG2003: No suitable injection token for parameter 'exportAsService' of class 'ReportRdComponent'. Consider using the @Inject decorator to specify an injection token.

    src/app/pages/report-rd/report-rd.component.ts:71:32 71 private exportAsService: ExportAsService,
    ~~~~~~~~~~~~~~~


    This type does not have a value, so it cannot be used as injection token.

    Error: src/app/pages/report/report.component.ts:13:49 - error TS2307:
    Cannot find module 'ngx-export-as' or its corresponding type declarations.


    I re-imported and tried too.

    Continue reading...

Compartilhe esta Página