Created
March 7, 2017 14:35
-
-
Save creimers/9a862c0435c43c60943432e4e8e317d5 to your computer and use it in GitHub Desktop.
a basic example of how to use an apollo query with variables and angular 1
This file contains 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
queryJobs() { | |
const jobQuery = gql` | |
query($city: String) { | |
jobs(city: $city){ | |
id | |
title | |
teaser | |
imageSmall | |
published | |
} | |
} | |
` | |
this.apollo.query({ | |
query: jobQuery, | |
variables: { | |
city: "Hannover" | |
} | |
}).then( result => console.log('got data: ', result) ) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment