Page Contents

Home > @loopback/context > inject > setter

inject.setter variable

Inject a function for setting (binding) the given key to a given value. (Only static/constant values are supported, it’s not possible to bind a key to a class or a provider.)

This is useful e.g. when implementing Actions that are contributing new Elements.

See also Setter<T>.

Signature:

setter: (bindingKey: BindingAddress<unknown>, metadata?: InjectBindingMetadata | undefined) => (target: Object, member: string | undefined, methodDescriptorOrParameterIndex?: number | TypedPropertyDescriptor<any> | undefined) => void