JSON

The data you get from the response is expected to be in JSON format.
JSON is a great way of transporting data, and it is easy to use within AngularJS, or any other JavaScript.
Example: On the server we have a file that returns a JSON object containing 15 customers, all wrapped in array called records.

Example

The ng-repeat directive is perfect for looping through an array:
Customer.html
{
"records": [
{
"Name": "D.G.prasad",
"City": "Vuyyuru",
"Country": "India"
},
{
"Name": "Anil",
"City": "Mexico D.F.",
"Country": "Mexico"
},
{
"Name": "Gowthami",
"City": "Vijayawada",
"Country": "India"
},
{
"Name": "Latha",
"City": "London",
"Country": "UK"
},
{
"Name": "Saradhi",
"City": "London",
"Country": "UK"
},
{
"Name": "Kiran",
"City": "Lulea",
"Country": "Sweden"
},
{
"Name": "Govind",
"City": "Mannheim",
"Country": "Germany"
},
{
"Name": "Saroja",
"City": "Strasbourg",
"Country": "France"
},
{
"Name": "Komali",
"City": "Madrid",
"Country": "Spain"
},
{
"Name": "Gokul'",
"City": "Marseille",
"Country": "France"
},
{
"Name": "Bottom-Dollar Marketse",
"City": "Tsawassen",
"Country": "Canada"
},
{
"Name": "Cactus Comidas para llevar",
"City": "Buenos Aires",
"Country": "Argentina"
},
{
"Name": "Centro comercial Moctezuma",
"City": "México D.F.",
"Country": "Mexico"
},
{
"Name": "Chop-suey Chinese",
"City": "Bern",
"Country": "Switzerland"
},
{
"Name": "Comércio Mineiro",
"City": "São Paulo",
"Country": "Brazil"
}
]
}
Customer1.html

<html>
<script src="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("customer.html").then(function (response) {
$scope.myData = response.data.records;
});
});
</script>

</body>
</html>

 

For
More Explanation
&
Online Classes

Contact Us:
+919885348743