Created
December 30, 2017 23:46
-
-
Save mphuie/cfd5c3a49b6b1fb6a38fc007e963c14b to your computer and use it in GitHub Desktop.
basic angularjs/angular1 graphql query using $http
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
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 | |
}) | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This works with a graph.cool endpoint. Not tested anywhere else.