title: Passing an array from service to controller
body: <p>I cannot seem to figure out how to pass an array from service to a controller.</p>
  
  <p>I have a simple service</p>
  
  <pre><code>.service('test', function() {
      var array = []
  
      return array;
  })
  </code></pre>
  
  <p>And a controller where I call this function when a button is pressed</p>
  
  <pre><code>$scope.testArray = function() {
      $scope.test = test.array;
  
      console.log("test: ", $scope.test);
  };
  </code></pre>
  
  <p>I get an error test is undefined. Can anyone explain to me please why this doesn't work and how to fix it? I tried storing that array in a separate object but no luck either. THanks</p>