i trying to pass the subscribe response of my Http.Get to a variable but always i try it the values when comes is undefined
TesteToken() : any {
let token;
this.http.get<any>(`${this.url}/token`).subscribe(res => {
token = res;
return token;
});}
but when i put this
TesteToken() : any {
let token;
this.http.get<any>(`${this.url}/token`).subscribe(res => {
token = res;
console.log(token);
});}
then works and the output is in console