• Stars
    star
    1,499
  • Rank 31,304 (Top 0.7 %)
  • Language
    TypeScript
  • License
    MIT License
  • Created over 8 years ago
  • Updated 26 days ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A fully-featured, production ready caching GraphQL client for Angular and every GraphQL server 🎁

Angular

Apollo Angular npm version

Apollo Angular allows you to fetch data from your GraphQL server and use it in building complex and reactive UIs using the Angular framework. Apollo Angular may be used in any context that Angular may be used. In the browser, in NativeScript, or in Node.js when you want to do server-side rendering.

Apollo Angular requires no complex build setup to get up and running. As long as you have a GraphQL server you can get started building out your application with Angular immediately. Apollo Angular works out of the box with both Angular CLI (ng add apollo-angular) and NativeScript with a single install.

Apollo Angular is:

  1. Incrementally adoptable, so that you can drop it into an existing JavaScript app and start using GraphQL for just part of your UI.
  2. Universally compatible, so that Apollo works with any build setup, any GraphQL server, and any GraphQL schema.
  3. Simple to get started with, so you can start loading data right away and learn about advanced features later.
  4. Inspectable and understandable, so that you can have great developer tools to understand exactly what is happening in your app.
  5. Built for interactive apps, so your users can make changes and see them reflected in the UI immediately.
  6. Small and flexible, so you don't get stuff you don't need. The core is under 12kb compressed.
  7. Community driven, because Apollo is driven by the community and serves a variety of use cases. Everything is planned and developed in the open.

Get started today on the app you’ve been dreaming of, and let Apollo Angular take you to the moon!

Installation

It is simple to install Apollo Angular and related libraries

# installing Apollo Angular in Angular CLI
ng add apollo-angular

# installing each piece independently
yarn add @apollo/client apollo-angular graphql

That’s it! You may now use Apollo Angular in any of your Angular environments.

For an amazing developer experience you may also install the Apollo Client Developer tools for Chrome which will give you inspectability into your Apollo Angular data.

  • If you are using Apollo-Client v3, please make sure to use apollo-angular@v3

    If you are using Apollo-Client v2, please make sure to use apollo-angular@v1 (and for Angular 10 support, make sure to use v1.10.0)

Usage

Now you may create components that are connected to your GraphQL API.

Finally, to demonstrate the power of Apollo Angular in building interactive UIs let us connect one of your components to your GraphQL server using the Apollo service:

import { Apollo, gql } from 'apollo-angular';
import { Component, OnInit } from '@angular/core';

const GET_DOGS = gql`
  {
    dogs {
      id
      breed
    }
  }
`;

@Component({
  selector: 'dogs',
  template: `
    <ul>
      <li *ngFor="let dog of dogs | async">
        {{ dog.breed }}
      </li>
    </ul>
  `,
})
export class DogsComponent implements OnInit {
  dogs: Observable<any>;

  constructor(private apollo: Apollo) {}

  ngOnInit() {
    this.dogs = this.apollo
      .watchQuery({
        query: GET_DOGS,
      })
      .valueChanges.pipe(map(result => result.data && result.data.dogs));
  }
}

To learn more about querying with Apollo Angular be sure to start reading the documentation article on queries.

Documentation

All the documentation for Apollo Angular including usage articles and helpful recipes lives on: https://www.apollo-angular.com/

Contributing

Read the Apollo Contributor Guidelines.

This project uses Lerna.

Bootstrapping:

yarn install

Running tests locally:

yarn test

Formatting code with prettier:

yarn prettier

This project uses TypeScript for static typing. You can get it built into your editor with no configuration by opening this project in Visual Studio Code, an open source IDE which is available for free on all platforms.

More Repositories

1

graphql-inspector

πŸ•΅οΈβ€β™€οΈ Validate schema, get schema change notifications, validate operations, find breaking changes, look for similar types, schema coverage
TypeScript
1,645
star
2

graphql-config

One configuration for all your GraphQL tools (supported by most tools, editors & IDEs)
TypeScript
1,170
star
3

graphql-hive

GraphQL Hive is a schema registry and observability
TypeScript
420
star
4

loona

πŸŒ• Application State Management done with GraphQL
TypeScript
265
star
5

bob

Build tool used in libraries maintained by The Guild
TypeScript
48
star
6

apollo-client-rxjs

Adds RxJS to ApolloClient
TypeScript
44
star
7

apollo-angular-ssr

Server-Side Rendering + Store Rehydration in apollo-angular
TypeScript
34
star
8

apollo-angular-services

Write .graphql files, use them as auto generated Angular services. https://github.com/kamilkisiela/apollo-angular-introduction
TypeScript
31
star
9

apollo-link-rxjs

Use RxJS with Apollo Link
TypeScript
30
star
10

angular2-graphql-rest

An Angular2 app with REST Api and GraphQL (apollo-client and angular2-apollo)
JavaScript
28
star
11

split-tests

Split test files in Jest and Cypress into parallel CI jobs
TypeScript
28
star
12

apollo-link-maxage

An Apollo Link to invalidate cached queries
TypeScript
21
star
13

angular-emojify

Angular Pipe that replaces all :emoji: with the actual emoji
TypeScript
18
star
14

apollo-angular-introduction

Use GraphQL in Angular - step by step - includes code generation
TypeScript
17
star
15

graphql-breaking-changes

Improving breaking change detection in GraphQL
TypeScript
15
star
16

angular-suspense

React-like Suspense API for Angular (Suspense + ErrorBoundary) - experimental
TypeScript
14
star
17

angular2-apollo-examples

List of angular2-apollo examples
13
star
18

cloudflare-graphql-api

GraphQL API for Cloudflare API
TypeScript
13
star
19

reddit-score-js

JavaScript implementation of Reddit hot ranking algorithm
TypeScript
10
star
20

rollup-plugin-graphql

Convert graphql files to ES6 modules
JavaScript
9
star
21

bru

Bru 🀡helps you manage monorepos!
TypeScript
9
star
22

apollo-angular-nativescript

NativeScript + Angular + GraphQL
TypeScript
8
star
23

apollo-angular-link-network-status

Information about the network status of your GraphQL operations. Built for Apollo Angular.
TypeScript
7
star
24

instagraph

GraphQL / REST API / Angular2
TypeScript
7
star
25

GitHunt-Lite-Angular

Step by step tutorial (see the steps branch)
TypeScript
6
star
26

ngx-graphql

TypeScript
6
star
27

incremental-schema-apollo-link

TypeScript
6
star
28

GitHunt-Lite-API

Step by step tutorial
JavaScript
5
star
29

apollo-rx-observable

An implementation of QueryObservable that works with RxJS
TypeScript
4
star
30

meteor-angular-lazy

An example of Lazy Loading Angular's NgModules with Meteor 1.5
TypeScript
4
star
31

graphql-modules

TypeScript
3
star
32

angular-graphql-subcriptions

GraphQL subscriptions in an Angular project
TypeScript
3
star
33

release-canary

JavaScript
3
star
34

graphql-stream

TypeScript
3
star
35

angular2-rest-to-graphql

How to implement GraphQL in your REST API based application
TypeScript
3
star
36

graphql-webpack

TypeScript
3
star
37

graphql-blog

AngularCamp 2017
TypeScript
3
star
38

string-env-interpolation

Use Environment Variables in String
TypeScript
3
star
39

nest-graphql-apollo

Nest GraphQL starter repository
TypeScript
2
star
40

httpcall

Make HTTP calls to remote servers
TypeScript
2
star
41

graphql-codegen-config

TypeScript
2
star
42

apollo-leaks

JavaScript
2
star
43

WhatsApp-ngAtlanta

What's app ngAtlanta?
TypeScript
2
star
44

graphql-inspector-example

Demo of GraphQL Inspector
JavaScript
2
star
45

meteor-angular-ui-router-example

Example AngularJS app with ui-router
JavaScript
2
star
46

angular2-graphql

TypeScript
1
star
47

bar

TypeScript
1
star
48

graphql-inspector-ci

Use GraphQL Inspector with any Continuous Integration
1
star
49

sequelize-init

reproduction
TypeScript
1
star
50

foo

1
star
51

apollo-angular-lazy-modules

Use multiple Apollo Clients in lazy loaded modules
TypeScript
1
star
52

collection-of-subgraphs

JavaScript
1
star
53

apollo-pessimism

JavaScript
1
star
54

vienna

TypeScript
1
star
55

meteor-typescript-testing

TypeScript
1
star
56

graphql-inspector-repro-1488

1
star
57

tsconfig-diff

Compare two tsconfig files
JavaScript
1
star
58

graphql-first-resolvers-firsters

TypeScript
1
star
59

gatsby-starter-netlify-cms

JavaScript
1
star
60

graphql-subscription-cases

TypeScript
1
star
61

apollo-angular-reproduction

Simple repository to use for an issue reproduction
TypeScript
1
star
62

incremental-graphql-schema

TypeScript
1
star
63

ccitest

JavaScript
1
star