Skip to content

Instantly share code, notes, and snippets.

@kamilkisiela
Created August 14, 2018 12:06
Show Gist options
  • Save kamilkisiela/ecd93025cc710ca055f03a8c32698507 to your computer and use it in GitHub Desktop.
Save kamilkisiela/ecd93025cc710ca055f03a8c32698507 to your computer and use it in GitHub Desktop.
Patterns
import { Apollo } from ‘apollo-angular’;
import gql from ‘graphql-tag’;
@Component({...})
export class FeedComponent {
constructor(private apollo: Apollo) {}
ngOnInit() {
this.apollo.watchQuery({
query: gql`
query Feed {
feed {
title
text
author {
name
}
}
}
`
}).valueChanges.subscribe(result => {
console.log(result.data);
})
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment