Skip to main content
cngx-src documentation

provideCommands

Functioncommon/commandv0.1.0

projects/common/command/provide-commands.ts

Description#

Registers one or more command sources. Each source becomes a multi entry on CNGX_COMMAND_SOURCE; call provideCommands from several app parts and injectCommands merges all of them.

Returns Provider[] (not EnvironmentProviders), so it registers at any injector scope - app root, a lazy route, or a component's providers / viewProviders - letting a route or component contribute a scoped command set without reaching for the raw CNGX_COMMAND_SOURCE multi-provider.

// app root
bootstrapApplication(AppComponent, { providers: [provideCommands(fileCommands)] });
// or component scope

Signature#

provideCommands(...sources: undefined)

Parameters#

@paramsources

Returns#

Provider[]