Page 1 of 1

Map service response paremeter to global scope variable?

Posted: Fri Mar 02, 2018 2:37 pm
by Alan Smith

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


Map service response paremeter to global scope variable?

Posted: Fri Mar 02, 2018 3:18 pm
by Serhii Kulibaba

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