Alan Smith
Posts: 0
Joined: Tue Jun 10, 2014 4:59 pm

Map service response paremeter to global scope variable?

How can I map the response parameter from a server code API call to a global scope variable?

1) I have setup the variable on the index page (auth,auth)
2) I have created a model, which a child variable (auth,token)
3) I am trying to set this global variable via a response parameter, like this:

$scope.auth.token = requestData.params.token;

But when i try and check if the variable exists on a different page, via this:

alert($scope.auth.token);

It says it is undefined?

The response is being returned as JSON

Whats the correct way to map the response parameter to the global scope variable?

Thanks

Serhii Kulibaba
Posts: 150
Joined: Tue Aug 27, 2013 1:47 pm

Map service response paremeter to global scope variable?

Hello Allan,

You use the requestData variable there, please change it to the response. It is available in the variable "success.data" in your success function

Return to “Issues”