*ngIf not working as expected with observable : <p>So I have these 2 buttons:</p>

<pre><code>&lt;a class="router-link nav-item" routerLink="/login" *ngIf="!isLoggedIn$ | async"&gt;
  Login
&lt;/a&gt;
&lt;a class="router-link nav-item" (click)="onLogout()" *ngIf="isLoggedIn$ | async"&gt;
  Logout
&lt;/a&gt;
</code></pre>

<p>And the logout button works perfectly, as soon as the user is logged in the button appears. But the login button never appears.</p>

<p>This is the code behind the <code>isLoggedIn$</code>:</p>

<pre><code>isLoggedIn$: Observable&lt;boolean&gt;;

ngOnInit() {
  this.isLoggedIn$ = this.authService.isLoggedIn;
}
</code></pre>

<p>AuthService:</p>

<pre><code>private loggedIn = new BehaviorSubject&lt;boolean&gt;(false);

get isLoggedIn() {
  return this.loggedIn.asObservable();
}
</code></pre>

<p>Hope this is enough information and the problem is clear, thanks in advance!</p>
