Hi all,

I'm setting ajax result into a service. while try to retrieve those results
getting undefined.

Eg:

$http({
        url: '/app/demo/sample?a=getSamplesBySearchText',
        method: 'GET',
        params: {
         "searchText" : searchText
        }
      }).then(function (result) {

       $scope.sampleResult=result;

*resultService.setResult($scope.sampleResult);*      ****Some codes*****

        $scope.result= *resultService.getResult();*

       console.log($scope.result); -----> *undefined*
      });


*inside resultService*:

var resultObject={};

this.
*setResult=function(value){*
resultObject=value;

if i print the "*resultObject*" - i'm getting the ans
};


this.
*getResult=function(){*   return resultObject;
}

Some one could explain why i'm not able to get those result's?

*Thanks & Regards,*
*Sasikumar.V*

-- 
You received this message because you are subscribed to the Google Groups 
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.

Reply via email to