Skip to content

Instantly share code, notes, and snippets.

@mphuie
Created December 30, 2017 23:46
Show Gist options
  • Save mphuie/cfd5c3a49b6b1fb6a38fc007e963c14b to your computer and use it in GitHub Desktop.
Save mphuie/cfd5c3a49b6b1fb6a38fc007e963c14b to your computer and use it in GitHub Desktop.
basic angularjs/angular1 graphql query using $http
var app = angular.module('plunker', []);
app.controller('MainCtrl', function($scope, $http) {
query = `{ allItems {
id
}}`
$http
.post('<graphql endpoint>', { query: query })
.then(function(resp) {
$scope.response = resp.data
})
});
@mphuie
Copy link
Author

mphuie commented Dec 30, 2017

This works with a graph.cool endpoint. Not tested anywhere else.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment