Programming Code Center(PCC)
[ANGULARJS]

(PCC)::[How-to-Read-a-static-JSON-file-in-AngularJS]::[angularjs]

File Name : index.html

<!DOCTYPE html>
<html>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.9/angular.min.js"></script>
<body>

<div ng-app="myApp" ng-controller="customersCtrl"> 

<ul>
  <li ng-repeat="x in myData">
    {{ x.Name + ', ' + x.Country }}
  </li>
</ul>

</div>

<script>
var app = angular.module('myApp', []);
app.controller('customersCtrl', function($scope, $http) {
  $http.get("customers.php").then(function (response) {
      $scope.myData = response.data.records;
  });
});
</script>

</body>
</html>

Output :

  • {{ x.Name + ', ' + x.Country }}