I'm trying to implement GET method inside Angular like this:
let resp = this.http.get("http://localhost:8082/voltage");
resp.subscribe((data)=> {this.message=data; console.log(data);});
console.log(this.message);
I get this.message as 'undefined'. From lot of other similar questions, I understood that this is an async call and data is not returned by the time I'm printing it.
How can implement a callback and get the data into a variable for accessing at later time?