This is my app
objectsApp.controller('ObjectsController', ['$http', '$scope', '$routeParams',
function($http, $scope, $routeParams) {
$http.post('1object.json', "my first write").then(function(data) {
console.log(data)
})
}]);
When run, this is the response (data)
Object {data: "", status: 200, headers: function, config: Object, statusText: "OK"}
However, there is no change to the file 1object.json (expected my first write)
The file 1object.json exists, but is just blank. I am running on a windows machine.
Why wouldn't this be writing?
POSTing to a static file does not automatically write to it. It depends on what your server is doing with the request. You would have to take the post body and write to that file explicitly..jsonfiles are static files with no dynamic language code processing. Have to use a server script in whatever language it is running to write to file ... and will find it simpler in the long run to use alternate storage like db than trying to index your own json files