I have made a simple DRF page with the following output:
[
{
"id": 1,
"name": "Michel",
"city": "Florida",
"country": "United States"
},
{
"id": 2,
"name": "Hasan",
"city": "London",
"country": "United Kingdom"
}
]
I have the following code in HTML:
<script src="angular.min.js"></script>
<div ng-app="myApp" ng-controller="myCtrl">
<ul>
<li ng-repeat="x in info">
{{ x.name + ', ' + x.country }}
</li>
</ul>
</div>
I have the following in a .js file:
var app = angular.module('myApp', []);
app.controller('myCtrl', function($scope, $http) {
$http.get("localhost:8000/index/info/")
.success(function(response) {
$scope.info = response[array name was supposed to go here];
});
The tutorial that I am following is this, which has the whole data in a an array with an array name. They used the name after response, see the .js file code. My question is, how can I give a name to my array, or call this array without a name?