-
Notifications
You must be signed in to change notification settings - Fork 27.1k
Improve error message for "No provider for" errors. #46189
Description
Which @angular/* package(s) are relevant/related to the feature request?
core
Description
In complex applications, it can be very tedious to debug "No provider for" errors, because Angular doesn't tell me what component or service it's trying to resolve when running into this error.
In my particular case, I have several components which have optional dependencies, depending on where in the application it is loaded. These dependencies are typically defined on parent components (or not). Clearly I forgot to mark it optional somewhere in one of my components, but in order to find out which one, I have to put a breakpoint on the error, go up several levels and hope to find what component it is instantiating.
Proposed solution
It would be very helpful if the error changed from "No provider for {requestedService}" to "No provider for {requestedService} while instantiating {component, service, pipe or whatever}"