Page Contents

Home > @loopback/context > inject > context

inject.context() function

Inject the context object.

Signature:

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

Returns:

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

Example

class MyProvider {
 constructor(@inject.context() private ctx: Context) {}
}