How do I make a service available to all components in a module within my app?
For example, given an app with a structure like:
- app
- Login.Component
- UserStory1.module
- View1.component
- View2.component
- ExportableView.Module
- ExportableView.component
- UserStory2.module
- View3.component
- ExportableView.Module/ExportableView.component
- CommonModule
- CommonLanding.component
I want a service UserStory1/LocalService that View 1 and View2 can use to be the source of state for that user story. I don't want that state to be available in UserStory2 -- it should have its own local service.
At first, just to have it available, I had UserStory1/LocalService as a provider in app.module -- and this works. But then when I move it to UserStory1.module it no longer works, each new component that is loaded has its own instance of localservice.