| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Name | Name | Last commit date | ||
|---|---|---|---|---|
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:
Get started today on the app you’ve been dreaming of, and let Apollo Angular take you to the moon!
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-cache-inmemory apollo-angular-link-http apollo-angular graphql-tag graphqlThat’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.
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 {Component, OnInit} from '@angular/core';
import gql from 'graphql-tag';
import {Apollo} from 'apollo-angular';
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.
All of the documentation for Apollo Angular including usage articles and helpful recipes lives on: https://www.apollographql.com/docs/angular/
Read the Apollo Contributor Guidelines.
This project uses Lerna.
Bootstraping:
yarn installRunning tests locally:
yarn testFormatting code with prettier:
yarn prettierThis 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.
| Back | FazBrowse Home | New Git URL |