title: AngularJS change property value based on another array
body: <p>I have a json data structured as:</p>
  
  <pre><code>$scope.items = [{"Color" : "Red", "Size": "Small" }, { "Color" : "Orange" "Size": "Small"}, {"Color" : "Green" "Size": "Extra-Large"}];
  </code></pre>
  
  <p>then I have a properties json data:</p>
  
  <pre><code>$scope.properties = [{"PropertyName" : "Color", "FilteredAs" : "AllColors"}, {"PropertyName" : "Size", "FilteredAs" : "AllSizes"}]
  </code></pre>
  
  <p>I am doing a server-side filtering that's why there's a FilteredAs property in my properties json data. What I want to happen is:</p>
  
  <p>If (items.key = properties.PropertyName) 
  example: "Color" (which is the first property in the items array) == "PropertyName" : "Color"
  then that corresponding object's FilteredAs property in the properties array is "FilteredAs" : "AllColors", AllColors will be changed to "Red".</p>
  
  <p>Any ideas on how to achieve this? Thanks!</p>
  
  <p>EDIT: This is what I have for now:</p>
  
  <pre><code>    angular.forEach($scope.items, function (value, key) {
              for (var i = 0; i&lt;= $scope.properties.length; i++) {
  
                  if ($scope.properties[i].PropertyName == $scope.items[value]) {
                      $scope.properties[i].SearchText = $scope.items[key];
                  }
              }
  </code></pre>