I dont know how to use the value of the currently returned Observable of getUserHeaders() in my http.get.
Personally, the solution to my problem was to use BehaviorSubject:
In service (source of the data):
private theBoolean: BehaviorSubject;
constructor() {
this.theBoolean = new BehaviorSubject(false);
}
public getTheBoolean(): Observable {
return this.theBoolean.asObservable();
}
To emit new value of theBoolean do smth like
public setTheBoolean(newValue: boolean): void {
this.theBoolean.next(newValue);
}
In component (user of the data):
this.theService.getTheBoolean().subscribe(value => console.log(value));
Credit to "pashozator" on Reddit