Created
August 14, 2018 12:06
-
-
Save kamilkisiela/ecd93025cc710ca055f03a8c32698507 to your computer and use it in GitHub Desktop.
Patterns
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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