javascript - How do I update/add to a JSON file using angularJS? -
i've created local json file , able data file using
app.controller('appctrl', function($scope, $http){ $http.get('employees.json').success(function(data){ $scope.employees=angular.fromjson(data.employees); console.log($scope.employees); }); //this data json file taken , stored $scope.employees. works fine }
i've been trying write equivalent http post call doing $scope.employees.push
, (understandably) updating value of local variable.
how update or add values original employees.json
file?
i don't think it's possible directly angular. there other sources integrate app, can have angular leverage.
- exploring filesystem api (html5) - verify browsers support this.
- another options jquery.twfile.
you store localstorage
, access other object. method i'd lean towards more (depending on size). otherwise i've had have server-side it.
Comments
Post a Comment