title: I want to Pass value to JSON in angularjs
body: <p>Please give me some example of $http.post. I am new in AngularJS. I want to update a JSON file while retrieving information from user. I want to update values but unable to update a JSON file.
  My JSON file is data.json.</p>
  
  <pre><code>    { var app=angular.module("APP",[]); 
   app.controller("APPController", function ($scope, $http){
     $scope.add = function(){
     var dataObj={ model:$scope.addModel,
      car: [$scope.option1, $scope.option2, $scope.option3, $scope.option4],
      type: $scope.Type};  
  $http.post("data.json",dataObj)  
  .success(function(res){console.log("success"+res.records)})  .error(function(res){console.log("error")}); 
   };
     });
    }
  </code></pre>
  
  <p>and here is my data.json file</p>
  
  <pre><code>    {
    "records": [
      {
        "model" : "car model",
        "car" : ["num1","num2","num3","num4"],
        "type" : "mode type"
      },
      {
        "model" : "car model",
        "car" : ["num1","num2","num3","num4"],
        "type" : "mode type"
      },
  ]
  }
  </code></pre>