0Pricing
Angular Academy · Lesson

Providers and Scopes

Control where services live in the tree.

Providers and Scopes

A provider tells Angular how to create a dependency. The scope where you register it determines how many instances exist and who shares them.

Root Scope

providedIn: root registers a service in the root injector: one shared singleton for the entire app. This is the most common choice.

@Injectable({ providedIn: 'root' })
export class AppStore {}

All lessons in this course

  1. Services and Injectable
  2. The inject Function
  3. Providers and Scopes
  4. Injection Tokens
← Back to Angular Academy