// logger.service.ts import { Injectable } from '@angular/core'; @Injectable({ providedIn: 'root' }) export class LoggerService { log(message: string) { console.log(`[${new Date().toISOString()}] ${message}`); } } // action-button.component.ts import { Component, inject } from '@angular/core'; import { LoggerService } from './logger.service'; @Component({ selector: 'app-action-button', standalone: true, template: ``, }) export class ActionButtonComponent { private logger = inject(LoggerService); doSomething() { this.logger.log('Button was clicked'); } } /* Notes: - LoggerService holds no state at all — it's a stateless service purely for shared behavior (timestamped logging), exactly the "services for logic, not just state" point from the chapter. - The component injects it the same way a stateful service is injected; DI doesn't care whether the service holds state or not. */