I cannot seem to figure out how to pass an array from service to a controller.
I have a simple service
.service('test', function() {
    var array = []
    return array;
})
And a controller where I call this function when a button is pressed
$scope.testArray = function() {
    $scope.test = test.array;
    console.log("test: ", $scope.test);
};
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
 
     
     
     
    