// login-status.component.ts import { Component } from '@angular/core'; @Component({ selector: 'app-login-status', standalone: true, template: ` @if (isLoggedIn) {
Welcome back!
} @else {Please log in.
} `, }) export class LoginStatusComponent { isLoggedIn = false; toggle() { this.isLoggedIn = !this.isLoggedIn; } } /* Notes: - @if/@else is the modern built-in control flow (Angular 17+) — no CommonModule import needed, unlike the older *ngIf directive. - When isLoggedIn is false, the "Welcome back!"is genuinely absent from the DOM (not just hidden), and the @else block's
is rendered in its place. */