Angular 7 go offline?

You can use the online flag on your router outlet with an ngIf

<router-outlet *ngIf="online$ | async else offline"></router-outlet>
<ng-template #offline>
  content here displays when not online
</ng-template>

or

<router-outlet *ngIf="online$ | async"></router-outlet>
<ng-container *ngIf="offline$ | async">
  content here displays when offline
</ng-container>

Leave a Comment