Page Contents

Home > @loopback/context > inject > getter

inject.getter() function

Inject a function for getting the actual bound value.

This is useful when implementing Actions, where the action is instantiated for Sequence constructor, but some of action’s dependencies become bound only after other actions have been executed by the sequence.

See also Getter<T>.

Signature:

getter: (bindingSelector: BindingSelector<unknown>, metadata?: InjectionMetadata) => (target: Object, member: string | undefined, methodDescriptorOrParameterIndex?: number | TypedPropertyDescriptor<any> | undefined) => void

Parameters

Parameter Type Description
bindingSelector BindingSelector<unknown> The binding key or filter we want to eventually get value(s) from.
metadata InjectionMetadata (Optional) Optional metadata to help the injection

Returns:

(target: Object, member: string | undefined, methodDescriptorOrParameterIndex?: number | TypedPropertyDescriptor<any> | undefined) => void