Skip to main content
cngx-src documentation

ENVIRONMENT

Tokenv0.1.0

InjectionToken<Environment>

Description#

Injection token for the application environment configuration.

A consumer-app utility: it gives application code (and app-level cngx wiring such as feature flags in providers) a typed DI handle on the environment.ts object instead of a direct module import, so the value can be swapped per bootstrap and stubbed in tests. No cngx library code reads it.

The token has no default factory. inject(ENVIRONMENT) without a provideEnvironment() in the bootstrap providers throws a NullInjectorError - deliberately, because a silently-empty environment would turn missing wiring into wrong runtime behavior. Code that must work without one reads it as inject(ENVIRONMENT, { optional: true }) and handles the null.

Type#

InjectionToken<Environment>