1

This is a simple test to fetch json file from third party server, but no success. I did test with this json (https://jsonplaceholder.typicode.com/posts) and is working. Any body can help me? Thanks in advance.

var app = angular.module("viewJSON",[]);
app.controller("viewCtrl",function Hello($scope, $http) {
    $http.get('http://media.astropublications.com.my/api/drebar_landing.json').
        success(function(data) {
            $scope.testJer = data;
     $scope.keys = Object.keys($scope.testJer[0]);
        });
});
section {height:180px;}
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.0/angular.min.js"></script>

  <link href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet">



  <div ng-app="viewJSON" ng-controller="viewCtrl">

  <div ng-repeat="item in testJer | filter:search">
    <section class="col-md-3">
        <h4>{{item.Title}}</h4>
        <p>{{item.Description}}</p>
    </section>
 </div>


  </div>

0

1 Answer 1

2

You need to access the ArticleObject array from the response ,

app.controller("viewCtrl", function Hello($scope, $http) {
  $http.get('http://media.astropublications.com.my/api/drebar_landing.json').
  success(function(data) {
    $scope.testJer = data.ArticleObject;
  });
});

PLUNKER DEMO

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.