title: updating a json value with angular
body: <p>I am trying to update an json object value from a textbox using angular and I'm not sure what the best way to go about it is.</p>
  
  <p>This is the json object...</p>
  
  <pre><code>   $scope.productAttributes = {
          "CostRequirements":[
              {
                  "OriginPostcode": 'NW1BT',
                  "BearerSize":100
  
              }
          ]
      }
  </code></pre>
  
  <p>And when a use types in a text field and clicks a button, I would like to grab that textfield value and pass it into the json object to replace the postcose value (OriginPostcode) I tried to pass in a scope variable but that didnt work.</p>
  
  <pre><code> &lt;input type="text" placeholder="Please enter postcode" class="form-control" ng-model="sitePostcode"/&gt;
  </code></pre>
  
  <p>And this is the fucntion that is fired when the user clicks a button to submit the json</p>
  
  <pre><code>var loadPrices = function () {
  
          productsServices.getPrices1($scope.productAttributes)
              .then(function (res) {
                  $scope.selectedProductPrices = res.data.Products;
                 // $scope.selectedProductAddOns = res.data.product_addons;
              })
              .finally(function () {
                  $scope.loadingPrices = false;
                  $scope.loadedPrices = true;
              });
      };
  </code></pre>
  
  <p>Could anyone tell me what I need to do to put the user input in the textbox into the json object?</p>
  
  <p>Many thanks</p>