JSFiddle - React, Tailwind, and code Playground

by Andrey

JavaScript

mymodule.factory('folioService', ['$http', function($http) {
       return {
            getFolios: function(){
                return $http.get('https://api.my.com/'); 
            }
        };
    }]);
    
mymodule.controller(    
    folioService.getFolios().then(function(data) {
                $scope.folios = data;//могу получить дату только здесь
                console.log($scope.folios);
            },
            function(error) {
                console.log(error);
            }
        );
    
    здесь $scope.folios == undefined;
    как получить data тут, снаружи ???
     
 );