Skip to content

Instantly share code, notes, and snippets.

@n8finch
Created September 19, 2016 03:10
Show Gist options
  • Save n8finch/1f5e4e20bd499098340e4230676aad57 to your computer and use it in GitHub Desktop.
Save n8finch/1f5e4e20bd499098340e4230676aad57 to your computer and use it in GitHub Desktop.
singleView-controller-genesis-angular-gulp.js
.controller('singleView', ['$scope', '$http', '$stateParams', function ($scope, $http, $stateParams) {
console.log('singleview running');
$http({
url: 'https://n8finch.dev/wp-json/wp/v2/posts?filter[name]=' + $stateParams.slug,
cache: true
}).success(function (res) {
$scope.post = res[0];
});
}]);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment