I'm trying to pass a global scope variable into a service header, but I'm not sure on the syntax for this?
I am using an Ionic server code POST request, and I am trying to pass a token via the Authorization header. I cannot seem to use a $scope variable.
The variable on my index page is: auth.
The variable on the model is authtoken
So, this is my sever code:
var url = "URL";
var XHRResponse = XHR2.send("POST", url, {
"headers": {
"Authorization": $scope.auth.token,
},
"body": ""
});
Apperyio.response.success(XHRResponse.body, "application/json");
What is the correct syntax for adding the global variable to the server code request header?