Apollo has a constructor which is not compatible with Dependency Injection. It should probably not be @Injectable().
See original GitHub issueI was following documentation from the https://www.apollographql.com/docs/angular/basics/setup/ trying to install Apollo Angular.
After running ng add apollo-angular
and updating API endpoint in the graphql.module.ts
, I’m getting Apollo has a constructor which is not compatible with Dependency Injection. It should probably not be @Injectable().
when trying to inject Apollo
from apollo-angular
in any component or service.
Angular version: 8.2.11
Angular Apollo version: 1.8.0
How this could be resolved?
Issue Analytics
- State:
- Created 4 years ago
- Reactions:11
- Comments:19 (2 by maintainers)
Top Results From Across the Web
This constructor is not compatible with Angular Dependency ...
Error: This constructor is not compatible with Angular Dependency Injection because its dependency at index 0 of the parameter list is invalid.
Read more >Error :This constructor is not compatible with Angular ...
This can happen if the dependency type is a primitive like a string or if an ancestor of this class is missing an...
Read more >Dependency Injection - Hot Chocolate
Of course this does not apply within your own dependencies. Your ServiceA class can still inject ServiceB through the constructor.
Read more >Dependency injection in React - LogRocket Blog
Dependency injection (DI) is a pattern where components necessary for your code to run are hot-swappable. This means that your dependencies ...
Read more >Dependency injection - TypeGraphQL
TypeGraphQL supports this technique by allowing users to provide their IoC container that will be used by the framework. Basic usage. The usage...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
There’s no stable Angular 9 yet so you guys please give me time to solve it. I started creating
apollo-angular
when Angular was in alpha, then in beta and then they changed bunch of stuff in one of RCs.As @Vilsol pointed out. It’s no longer an issue in
9.0.0-rc.2
.It’s an open-source project and I’m the only one developing it (Apollo Team haven’t pushed a single line of code). If you want to help, please provide reproductions or even pull requests, this speeds up things a lot.
@kamilkisiela I want to personally thank you for all your work. This project is awesome. I really do appreciate you taking the time to look into this. Thank you.