Using ngIf with an Else Block
Demonstrate ngIf with an else block using a template reference. If a user is not logged in, display a login button; otherwise, display a logout button.
<button *ngIf="isLoggedIn; else loginButton">Logout</button>
<ng-template #loginButton><button>Login</button></ng-template>
Angular template snippet using ngIf with an else block. If 'isLoggedIn' is true, it displays a 'Logout' button. If 'isLoggedIn' is false, it references the else block 'loginButton' that contains a 'Login' button.