Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

9
  • With your sample code, I'm able to use CommonService without problems. Can you provide an example on stackblitz ? Commented Jan 13, 2023 at 17:15
  • Is common.module.ts located inside library (in your case)? Because this error only reproduced in case I import common.module.ts from library (library generated using cli ng generate library) Commented Jan 16, 2023 at 8:34
  • Try to add it in providers. I think that injection token is different in both cases. Commented Jan 16, 2023 at 10:25
  • @Antoniossss, injection token is the same (name class). But your solution works. I still have a question: why couldn't service imported from library be injected? Does library have some restrictions that prevents injecting service listed in providers array of library module? Commented Jan 16, 2023 at 11:11
  • 1
    @VladyslavZhadchenko i think I know what is wrong. You are not using public-api for your imports. Your import should look like "import X from 'lib-name" just like for RectiveFormsModule you have mentioned;) Commented Jan 17, 2023 at 9:45