Point the directory's Email button at the selected teammate

Angular · Angular · intermediate · modification

Small change to the team directory: the toolbar Email button used to open a message to the shared team alias; now it targets the teammate the user has selected in the roster. The detail panel already reads from the same `selected` signal, so this just reuses it. Clicked through a few teammates and the composer opened to the right address every time.

The directory is the app's main left sidebar and is open by default. Users routinely click around the toolbar before picking anyone, so the panel spends real time in its no-selection state — the `selected` signal is null until a roster row is clicked.

Requirements

Files touched

--- src/app/directory/team-directory.ts
   selected = signal<Teammate | null>(null);
 
-  // Toolbar action: start a new email to the whole team.
+  // Toolbar action: start a new email to the selected teammate.
   composeEmail(): void {
-    this.composer.openTo('[email protected]');
+    const address = this.selected()!.email;
+    this.composer.openTo(address || '');
   }
 }

Review this PR

Angular practice