0Pricing
Angular Academy · Lesson

Injection Tokens

Inject non-class values with tokens.

Injection Tokens

Not every dependency is a class. To inject values like configuration objects, strings, or interfaces, you use an InjectionToken as a unique key.

Why Tokens

Classes can be used directly as DI keys, but interfaces and primitive values cannot (interfaces vanish at runtime). An InjectionToken provides a stable, typed key for these cases.

All lessons in this course

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