I have a call call and a mail call in my node.js file, both of which use the same variable that I initialized with an empty string outside of these calls. In the post call, I set the variable, while in the get call I return the value of the variable to my client angularjs that are requesting the value. In my angularjs file, I first make a post call and then a get call, which means the value must be set and must be available when the get call is issued and returned. That's what I'm doing:
NodeJS
var myUrl= "";
app.post('/post', function(req, res){
myUrl = res.url;
});
app.get('/get, function(req, res){
res.json({result: myUrl});
});
AngularJS:
var promise = $http.post('/post')
.then(function(response){
return $http.get('/get');
}).then(function(response){
console.log(response.data.result);
});
AngularJS, . , , , get , url , , get call . get , .. ..
, , , , get , ( get , )? NodeJS, !