I am trying to get value from http.get() and assign it to local variable.
Here is my code. UserName.ts
import { Http } from '@angular/http';
this.http.get('http://localhost:8000/user/').subscribe(res => {
this.username$ = res;
console.log(this.username$)}) //working
console.log(this.username$)
I am getting undefined as output
The http call - http://localhost:8000/user/ will return only one username. I have to store it in a variable. And use it to invoke another http call
return this.http.get(`http://localhost:8001/getdettails/${this.username$}/${experimentPath}`)
Please help me in solving this issue.Thanks.