I inject this into my controller module:
var services = angular.module('services', []);
services.factory('jsonManager', ['$http', function($http) {
return{
  loadData: loadData
}
function loadData(){
   $http({
     method: 'GET',
     url: 'data/2015_data.json'
}).then(function successCallback(response) {
    return response.data;
  }, function errorCallback(response) {
    return response.err;
  });
}
}]);
... and it doesn't work! I'm using it on the controller like this, check it out:
var ctrls = angular.module('controllers', ['services']);
ctrls.controller('overviewController', ['jsonManager', '$scope', 
function(jsonManager, $scope){
$scope.load = function(){
  var datos = jsonManager.loadData();
  console.log(datos);
  $scope.gastos = datos.gastos.data;
  $scope.ganancias = datos.ganancias.data;
}
I omitted some code from my controller; the scope objects work properly. The problem is, that I get an error that tells me that "datos" is undefined at lines 55 and 56. Why does this happen?
 
     
     
    