AngularJS是否支持Apollo Client?Cordova应用适配咨询
Hey there! Let me break this down clearly for you since you're just getting started with GraphQL and Apollo:
First off, there’s no official Apollo Client integration built specifically for AngularJS (Angular 1.x). The Apollo team focuses their official support on modern Angular (Angular 2+), since AngularJS is now in long-term maintenance mode. But that doesn’t mean you can’t use Apollo Client with your AngularJS Cordova app—here are your practical options:
Use the core Apollo Client library directly
Apollo Client itself is framework-agnostic. You can install the coreapollo-clientpackage, set it up with anHttpLinkpointing to your Express/Apollo server, then call methods likeclient.query()orclient.mutate()right from your AngularJS controllers or services. You’ll just need to manually bind the returned data to your AngularJS scopes. It’s a bit more hands-on, but totally workable for basic to moderate use cases.Explore community-maintained bridge libraries
Some community developers have created third-party wrappers to make Apollo Client play nice with AngularJS, likeangular-apollo(don’t mix this up with the officialapollo-angular—that’s for modern Angular). These libraries usually expose Apollo functionality as AngularJS services or directives, making it feel more native to your existing codebase. Just keep in mind: community tools might not have the same level of updates or support as official ones, so check their GitHub activity and docs first.Consider a gradual migration (if feasible)
If your team has plans to upgrade the app eventually, you could start by using the core Apollo Client in your AngularJS code now. Then, as you migrate parts of the app to modern Angular, you can transition to the officialapollo-angularlibrary. This lets you get started with GraphQL immediately while laying groundwork for future tech stack upgrades.
As someone new to Apollo, I’d recommend starting with the core library if you go this route—get comfortable with basic queries, mutations, and caching first before tackling more complex features like subscriptions.
内容的提问来源于stack exchange,提问作者Ahmad Bilal

