Skip to content

Instantly share code, notes, and snippets.

@n8finch
Created August 29, 2016 15:37
Show Gist options
  • Save n8finch/ca40070992824be2842021b07ef2f07d to your computer and use it in GitHub Desktop.
Save n8finch/ca40070992824be2842021b07ef2f07d to your computer and use it in GitHub Desktop.
angular-basic-http.js
(function (angular) {
'use strict';
angular.module('myApp', [])
.controller('example', ['$scope', '$http', function ($scope, $http) {
$http({
url: 'https://n8finch.dev/wp-json/wp/v2/posts',
cache: true
}).success(function (res) {
$scope.posts = res;
console.log(res);
});
}]);
})(window.angular);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment