core / Function

provideMulti

Generic types:T

Type-safe factory function for producing multi Provider configs.

See Also

Presentation

Returns

Provider -

a Provider object

Parameters

NameTypeDescription
config
ProvideMultiConfig<T>

type-safe configuration object

Example usage

provideMulti({ token: TitleStrategy, useClass: AppTitleStrategy });
// Type error. TitleStrategy does not support multi providing.
// Argument of type '{ token: typeof TitleStrategy; useClass: typeof AppTitleStrategy; }' is not assignable to parameter of type 'never'.

provideMulti({ token: APP_INITIALIZER, useFactory: () => () => {} });
// Legit. The return type of the factory matches the item type of APP_INITIALIZER