ApolloGraph Client For Angular
From Logic Wiki
Contents
Installation
NPM
npm install apollo-angular apollo-angular-link-http apollo-client apollo-cache-inmemory graphql-tag graphql --save
NgModule
import { NgModule } from '@angular/core';
import { HttpClientModule } from '@angular/common/http';
import { ApolloModule, Apollo } from 'apollo-angular';
import { HttpLinkModule, HttpLink } from 'apollo-angular-link-http';
import { InMemoryCache } from 'apollo-cache-inmemory';
@NgModule({
imports: [
HttpClientModule, // provides HttpClient for HttpLink
ApolloModule,
HttpLinkModule
]
})
class AppModule {
constructor(
apollo:Apollo,
httpLink: HttpLink;
){
apollo.create(
link:httpLink.create( {url:'http://graphqlserver.com'}),
cache: new InMemoryCache()
)
}
}
Playground
lounchpad.graphql.com