title: angularjs http post to json array at specific element
body: <p>I am trying to find a best way to update the file on the server with new elements. I tried looking into http post/put but I am getting an error and not sure exactly how to get this fixed.
  My http get method is working fine, so it's not an environment issue.</p>
  
  <p>based on the comments here is the addition information and I have corrected the json file format as well.</p>
  
  <p>Development environment:
  Visual Studio 2013, .net 4.5, iis</p>
  
  <p>json data file sits on one of the folders under Visual studio solution.
  However I am only using angular features to develop this one page app, so no asp.net features in my code so far.
  I had to add  to access the json file in the solution.</p>
  
  <p>I have a simple car app for owners which loads from following array from file source using http get:</p>
  
  <pre><code>    owners: [{
              "name": "name1",
              "age": 29,
              "cars": [
                  {
                      "carmodel": "tyota",
                      "make":  2000
                  },
                  {
                      "carmodel": "ford",
                      "make":  2001
                  }
              ]
              },
              {
              "name": "person1",
              "age": 50,
              "cars": [
                  {
                      "carmodel": "ford",
                      "make":  2011
                  }
              ]
              }
          ]
  </code></pre>
  
  <p>from UI I am getting a new car object for say "person1"</p>
  
  <pre><code>car: {
          "carmodel": "BMW",
          "make":  2015
       }
  </code></pre>
  
  <p>I would like to add this to the file using httppost or any other best practice method.</p>
  
  <p>I have a save function which throws post error: 405 (Method Not Allowed)</p>
  
  <pre><code>$scope.save = function(owner, car, $http)
  {
     $scope.owners[1].cars.push(car); 
     // above is hard coded, how can filter owners with owner object?
     $http.post('url',$scope.owners);
  }
  </code></pre>
  
  <p>I am wondering what is the best practice update file on server. any help on this would be grateful.</p>