Question: I don't know how to resolve this problem,can someone help me.

```
The following packages have unmet dependencies:
 testdisk : Depends: libntfs-3g861
E: Unable to correct problems, you have held broken packages.

```

Answer: 
Can you try after changing your template like this:

```
<ul class="nav navbar-nav">
      <li><a [routerLink]='["/search"]'>Search <span class="slider"></span></a></li>
      <li *ngIf="isLoggedIn$ | async"><a (click)="logout()">Logout</a></li>
  </ul>

```

Notice the `async` pipe to unwrap the observable value.

Notice in the stackblitz example shared by you - Observable value was unwrapped using `async` pipe - 

```
<mat-toolbar color="primary" *ngIf="isLoggedIn$ | async as isLoggedIn">

```
to your last comment, this is happening because the service is being re-initialized and your observable are being reset. Add this to your constructor 

```
if(localStorage.getItem('currentUser') != null)
    this.loggedIn.next(true);

```

This worked for me.