title: Angular $http.get with dynamic route?
body: <p>I'm fairly new to angular and I'm trying to understand how to query from a REST API using a scope variable to determine the URI that is being pulled in the get request.</p>
  
  <p>Lets say I'm in my app.controller and it has a service that spits out an array of numbers.. and for the sake of making the code minimal, I'll skip to the important part:</p>
  
  <pre><code>$scope.currentCompanyId = '0001';
  
  $http.get('/api/'+ $scope.currentCompanyId +'/c').
    success(function(data, status, headers, config) {
      $scope.cData = data;
    }).
    error(function(data, status, headers, config) {
      // log error
    });
  </code></pre>
  
  <p>I know this is cheating because the $http.get is in the controller. I know it needs to be a factory of some kind.. but I have no idea how to pass the $scope.currentCompanyID to the get request and have it return the JSON. Furthermore, if $scope.currentCompanyID were to change to another number, say... '0002'.. how would the $scope.cData change to reflect the new query?</p>