'Dependency injection of service within Angular component library

I am creating an Angular component library. Each component is set up to be its own sub-entry point. One of these components is a simple button (@myorg/ui/button). The button injects a service from @myorg/ui/theme. The library builds without issue and I can use the button component in a demo app within the same workspace.

The problem is when I import my library into an Angular app in a separate workspace. When I try to build the consumer app that uses the button, an error is thrown in the imported button:

Cannot find module '@myorg/ui/theme' or it's corresponding type declarations.

import { ThemeService } from "@myorg/ui/theme";

I'm not sure what I need to do in order my library's button to properly use a service.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source