i want to implement a service and let it provide to only one named component or module and not to any other component or module.
So whenever anyone tries to provide that service to another component they get an error and the program should not compile.
Is there any way to do that?
Thanks in advance.
EDIT:
I guess you misunderstood my question. I am saying that no developer shall be able to add that service to any where in providers array except one component tree.
If you provide it to a component it will only be available to that component and its children:
See: https://angular.io/guide/providers#limiting-provider-scope-with-components.
A way to limit scope to a module or component:
So if this component itself has no children, it is in fact the only named component that has access to it. Other components will receive an Injector Error