Angular 22 · Signals and services

Create a service

Make a class injectable in the root injector, so one instance is shared.

@Injectable({ providedIn: 'root' })
export class AuthService {
  user = signal<User | null>(null);
}

Official Angular 22 documentation

More signals and services commands

All signals and services commands · Angular 22 cheatsheet

Was this page helpful?