M
M
Max Khimenko2016-07-30 10:42:57
JSON
Max Khimenko, 2016-07-30 10:42:57

How to correctly link from post list to one post Angular Js + Wp Rest Api?

Good afternoon.
Prompt or give an example please: how to properly call a specific entry from the list of entries.
Here is my controller that calls posts to the page:

.controller('eventsCtrl', function($scope,$http) {
  $scope.posts = [];
var wordpressUrl = "http://nn.allsay.kz/wp-json/wp/v2/posts?categories=19";
  $http.get(wordpressUrl)
    .success(function(response){
      console.log("Reveived getPosts via HTTP: ", response, status);
      angular.forEach(response, function(child){  
        $scope.posts.push(child);
      });
    })
    .error(function(response, status){
      console.log("Error while received response. " + status + response);
    });
})

I created a template for a separate entry, how can I make you the right call? How to write a route? Are there any examples on the net, maybe I'm looking for something wrong in Google?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question