I want to call v = "'"+u+"'"
value into post method and i declared them as global variable. I'm not able to console those values outside get method. It's throwing me error. How to fix this ?
scope.Ex = function() {
var u,w,v,c,is;
$http.get("/api/patients/")
.then(function(response) {
scope.content = response.data;
c = scope.content;
is =c["0"].patient_ID;
u = '/api/patients/'+is+'/';
v = "'"+u+"'"
});
console.log(v);
$http.post("/api/exams/",
{
patient_ID : v // I want to call V here from get method
// patient_ID : "/api/patients/1/"
})
.error(function(err){
//console.log(err);
})
.success(function(response)
{
//console.log(v);
//console.log("Success")
//console.log(response);
//$scope.usersData = response;
});
};