title: How do I make a dynamically named $scope variable?
body: <p>I have several (over 30) feeder lists which the console.log has several nodes looking like this:</p>
  
  <pre><code>{
     [functions]: ,
     __metadata: { },
     ID: 8,
     Id: 8,
     Title: "SharePoint"
  }
  </code></pre>
  
  <p>So I want to display the <strong>name</strong> (which in SharePoint that is called <strong>Title</strong>) of <strong>ANY OF THE LISTS</strong> rather than the ID by modifying this function to accept a <strong>list</strong> parameter and dynamically create a <strong>$scope."list"[w]</strong> variable. It would save me having to duplicate 30 functions that look like this:</p>
  
  <pre><code>$scope.getWebsite = function(id){
      for(w=0; w&lt;$scope.websites.length; w++){
          if($scope.websites[w].ID == id){
          return $scope.websites[w].Title;
          } // end if
      } // end for
  };
  </code></pre>
  
  <p>and call it like this:</p>
  
  <pre><code>&lt;p&gt;{{getValue('division', thisProject[0].Division_ID)}}&lt;/p&gt;
  </code></pre>
  
  <p>I tried this and it didn't work:</p>
  
  <pre><code>$scope.getValue = function( list, id ){
      var dyno = '$scope.' + list;
      for(w=0; w&lt;dyno.length; w++){
              if(dyno[w].ID == id){
              return dyno[w].Title;
              } // end if
          } // end for
      };
  </code></pre>