I have declaration of providers in app module which provides list of implementations of MyProviderService
class (I am using multi: true
). Now I would like to "undefine" this list in one component completely, so I added:
@Component({
providers: [
{ provide: MyProviderService, useValue: undefined },
],
})
That works and injector has empty value for the MyProviderService
. I am wondering if there is a way to remove the MyProviderService
from injector completely. Something that would later require to mark the service as @Optional
in the constructor for DI.