Page Contents

Home > @loopback/context > inject > context

inject.context() function

Inject the context object.

Signature:

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

Returns:

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

Example

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