Q:

FirebaseUI authState subscribe: returning values

I am having some trouble understanding how to return and use the data returned with angular and FirebasUI (https://www.npmjs.com/package/firebaseui-angular).
For now, I am returning data from the authstate with
ngOnInit(): void {
this.afAuth.authState.subscribe(d => console.log(d));
}

and this returns in the console
{currentUser: Hk, credential: null, redirectUrl: undefined}

my question: how do I access currentUser in order to use *ngIf to apply conditional formatting of my pages.
Thanks in advance

A:

Alright, I found a way to perform the requested action:
first declare a property in the component class:
email: string = 'placeHolder';

Then in the subscribe response I assign the needed data from d:
ngOnInit(): void {
this.afAuth.authState.subscribe(d =>
  {
    console.log(d);
    this.email = d.email;
    if (this.email != 'placeHolder') {
      this.hasEmail = true;
    } else {
      this.hasEmail = false;
    }
  });

}
After then I simply use *ngIf="hasEmail" in my selectors and it works!
Maybe there is a better solution, but at least this works for me.

