inject() function
@microsoft/fast-element/di.js > inject
inject() function
A decorator that specifies what to inject into its target.
Signature:
inject: (...dependencies: Key[]) => (target: any, key?: string | number, descriptor?: PropertyDescriptor | number) => void
Parameters
Parameter | Type | Description |
---|---|---|
dependencies | Key[] | The dependencies to inject. |
Returns:
(target: any, key?: string | number, descriptor?: PropertyDescriptor | number) => void
The decorator to be applied to the target class.
Remarks
The decorator can be used to decorate a class, listing all of the classes dependencies. Or it can be used to decorate a constructor paramter, indicating what to inject for that parameter. Or it can be used for a web component property, indicating what that property should resolve to.