Take the 2-minute tour ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

in my controller i have a function

$scope.orderHistory = {};
$scope.results = {};

var getHistory = function (max,offset)
 {
    //do some stuff
    $scope.orderHistory = data.entities;

    angular.forEach($scope.orderHistory,function(value)
    {
        $scope.results = getResults(value.id);
        console.log($scope.results);

    });

 }


 var getResults = function(id)
 {

    api.getHistoryData(id)
        .then ( function (results)
        {
            return results.data;

        });


 };

the problem i run into is the getResults function does not seem to actually return the data and have it set to $scope.results inside the getHistory function.

When i do a console.log in (results.data) inside the .then part of getResults function i see the results. Can anyone help me understand why it is not returning the results even though it exists and what i can do to fix it

share|improve this question
    
You are expecting $scope.resulsts the array of results? –  PSL Aug 14 at 17:57
    
yes $scope.results should be the results and when i do a console.log($scope.results) i should see the results returned from getResults() –  Yeak Aug 14 at 17:58
    
is orderHistory array or is it an dictionary? –  PSL Aug 14 at 18:04
    
orderHistory is an array –  Yeak Aug 14 at 18:09

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.