How to prevent error "No provider for xxx! - in Module "xxx" (Operation Scope)" when adding new provider #2223
Unanswered
CodePlato3721
asked this question in
Q&A
Replies: 1 comment
-
|
Can anyone help us? |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Recently our project team met an issue.
Scenario
There are 2 modules
ModuleAandModuleB.ModuleAhas a providerProviderFoo.ProviderFoousesRESTDataSourceAwhich is also a providerModuleBhas a providerProviderBarwhich usesProviderFooofModuleAThe design looks like below
Recently, we add a new

RESTDataSourceB.ProviderFoousesRESTDataSourceBas well. But we forgot to register theRESTDataSourceBinModuleB. Then we got this errorNo provider for RESTDataSourceB! - in Module "ModuleB" (Operation Scope)Because we can't prevent engineers from making similar mistakes when adding a new
Provider. QA will only testModuleAif this change is made forModuleA. How to prevent the same issue happen again?The solution I can think about is create a
allProviders.ts. Include all the providers in this file likeBut it's an ugly solution. Is there any better solution can fix this issue?
Beta Was this translation helpful? Give feedback.
All reactions