provideDirection
projects/core/bidi/direction.ts
Description#
Override the direction the CNGX_DIRECTION signal reports with a
fixed value, without touching documentElement.dir. This is the
environment-scoped entry - bootstrap providers or route providers.
Use it in tests or in SSR with a known locale. It installs no observer and
never writes the DOM - dir stays the app's to set. For a per-subtree
override in a component's viewProviders, use provideDirectionAt
(element injectors reject the EnvironmentProviders this returns).
bootstrapApplication(AppComponent, {
providers: [provideDirection('rtl')],
});This overload takes a fixed value. To drive the reported direction from a
reactive source (a router-derived locale signal, a settings store),
override CNGX_DIRECTION directly with a useFactory returning your
own Signal<CngxDirection>:
{ provide: CNGX_DIRECTION, useFactory: () => myLocaleDirection }.