The html code below:- ` AngularJS | $http server
<div ng-controller="people">
<ul>
<h2> Names and Ages of progrmmers: </h2>
<li ng-repeat="person in persons">
{{person.Name + ':' + person.Age}}
</li>
</ul>
</div>
The js file below :
var app=angular.module('mainApp',[]);
app.controller('people',function($scope,$http){
$http({
method: 'POST',
url: 'http://localhost/AngularJS/post.json',
data:{"Name": "1234", "Age":"13","Fav_Color":"black"},
headers:{'records':'json'}
})
.success(function(response){
$scope.persons=response.records;
});
});
I need the data to be saved in a file name "post.json". But it is not working. So anyone could tell what is wrong with my code.