Your expression *ngIf="!isAuth() | async"
will be interpreted as:
isAuth() -> returns observable !isAuth() -> returns false because of ! !isAuth() | async -> actually trying to subscribe on false which should fail
Just use !(isAuth() | async)
instead.
Another problem is that you call the server twice when loading the template. This is something you probably don't want to do.
And finally this
this.loginservice.getAuthenticated() .map(user => { if(user){ if(user.hasOwnProperty('uid')){ return true; } else { return false; } } else { return false; } })
can be written as
this.loginservice.getAuthenticated() .map(user => user && user.hasOwnProperty('uid'))
and angular 5+ as
this.loginservice.getAuthenticated().pipe( map(user => user && user.hasOwnProperty('uid')) )
source share