AngularJS Reading a static JSON file




AngularJS Reading a static JSON file

<!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