samedi 28 mars 2015

Manipulate Data with JSON using Angular JS for WordPress JSON API


Vote count:

0




I tested code in this post and modified a bit for my use. But I cannot get JSON object from API of my blog that I have generated using WordPress JSON plugin.



  1. URL API from BLOG (NOT WORKING): http://ift.tt/19aNlCV

  2. URL from W3C example (WORKING): http://ift.tt/1CBMZ2P


I stuck when tried to manipulated JSON API from my blog (mentioned above) and the same code worked for the other url provided by w3c example?


Please provide your suggestion.


I am using below codes in .html file and not in WordPress environment.


==== Angular JS Script ====



(function() {
var app = angular.module('tsApp', []);
app.controller('TSController', function($scope, $http) {
$scope.heading = [];
$http({
method: 'GET',
url: 'http://ift.tt/19aNlCV'
}).success(function(data) {
console.log("pass");
$scope.heading = data; // response data
}).error(function(data) {
console.log("failed");
});
});
})();


==== HTML ====



<html ng-app="tsApp">
<body ng-controller="TSController as tsCtrl">
<article class="main-content" role="main">
<section class="row">
<div class="content">
<div class="name-list">
<h1>Dummy Title</h1>
<ul>{{ 1+1 }} (Testing AJS is working)
<li ng-repeat="title in heading" class="">
<h3>{{title.Name}}</h3>
</li>
</ul>
</div>
</div>
</section>
</article>
<script type="text/javascript" src="js/main.js"></script>
</body>
</html>


I am raising this question after checking for all solution online http://ift.tt/19aNk1V and http://ift.tt/1mlecNW But nothing worked for me.


Creating JSFiddle for your convenience: http://ift.tt/1D0ZBSI



asked 1 min ago







Manipulate Data with JSON using Angular JS for WordPress JSON API

Aucun commentaire:

Enregistrer un commentaire