this.penService.user(this.phone).then((response) => {
this.data = response;
console.log("Data: ", this.data); // here the response is available
return this.data;
}).catch(err => console.error(err));
console.log(this.data); // this is where it is undefined or not available
I have the above code which returns the correct response and gives me the value inside the call.
but when I call the same response outside, it is not available.
Any help would be great!