Hi all,

How to store ajax result into one scope variable ? I need to use that
result inside my controller.

Eg:

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

       *$scope.sampleResult=result;*
       console.log($scope.sampleResult); -----> Here i'm getting result eg:
{name:"adams",age:"21"}
      });

console.log(*$scope.sampleResult)* ----> *Undefined*

If i try to print that result out side that method i'm getting undefined. I
don't know why it's not printing those ajax result outside that method?

Some one could help me to get those result and explain me why i'm not
getting those  values



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