This is not a duplicate of this for several reasons. 1. I am using angular 7 not angular 2. 2. I am using rxjs6 not rxjs5. I have no benefit in learning these earlier versions as they are extinct. 3. I am asking about an Observable(boolean) concept when this question does not mention Observable(boolean)
I created an Observable value that I want true/false from it. Here is my code in nav.component.ts file
export class NavComponent implements OnInit {
private $loggedin: Observable<boolean>;
constructor( private auth: AuthenticationService){}
ngOnInit() {
this.$loggedin = this.auth.$isLoggedinSource;
console.log('am i logged in ', this.$loggedin);
}
The console output is :
am i logged in Observable {_isScalar: false, source: BehaviorSubject}
source: BehaviorSubject {_isScalar: false, observers:
Array(0), closed: false, isStopped: false, hasError:
false, …}
_isScalar: false ...
How can I get a boolean, true/false value out of $loggedin?