Get your own Angular server
main.ts
index.html
 
import { bootstrapApplication } from '@angular/platform-browser';
import { Component } from '@angular/core';
import { CommonModule } from '@angular/common';

@Component({
  selector: 'app-root',
  standalone: true,
  imports: [CommonModule],
  template: `
    <h3>Conditional Rendering with ngSwitch</h3>
    <label>
      Status:
      <select (change)="status = $any($event.target).value">
        <option value="loading">loading</option>
        <option value="success">success</option>
        <option value="error">error</option>
      </select>
    </label>

    <div [ngSwitch]="status">
      <p *ngSwitchCase="'loading'">Loading...</p>
      <p *ngSwitchCase="'success'">Success!</p>
      <p *ngSwitchCase="'error'" style="color:crimson">Error!</p>
      <p *ngSwitchDefault>Unknown status</p>
    </div>
  `
})
export class App {
  status = 'loading';
}

bootstrapApplication(App);

                    
<!doctype html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <title>Angular Conditional Rendering - ngSwitch</title>
</head>
<body>
  <app-root></app-root>
</body>
</html>