The title says it all really. How can I get the current value from an Observable without subscribing to it? I just want the current value one time and not new values as they
Not sure if this is what you are looking for. Probably write that behaviorsubject in a service. Declare it as a private and expose only the value that you have set. Something like this
@Injectable({
providedIn: 'root'
})
export class ConfigService {
constructor(private bname:BehaviorSubject){
this.bname = new BehaviorSubject("currentvalue");
}
getAsObservable(){
this.bname.asObservable();
}
}
This way the external users only have access to subscribe to the behaviorSubject and you get to set the desired value in the service.