I have build a demo which creates 2 custom angular elements (checkout app.module). Works like a charm, but there is one problem, if I provide a service in the parent element (called BarComponent), it is not received by the its child CE (called TestComponent)
@Component({
templateUrl: './bar-ce.component.html',
providers: [TestService] // <-- this one!!
})
export class BarComponent {}
Inside its html it renders the child CE: TEST-CE: <test-ce></test-ce>
If I try to inject my TestService this way I get the "NullInjectorError: No provider for TestService!"
But if I provide it inside the app.module it all works again. So my question is, is there a way to fix this or is this just the way it is with CE (hope not)?
Shared service should be provided in module. And latar initialize in constructor (private testService: Testservice)