@loopback/docs
Version:
Documentation for LoopBack 4
34 lines (21 loc) • 758 B
Markdown
lang: en
title: 'API docs: context.inject.context'
keywords: LoopBack 4.0, LoopBack 4
sidebar: lb4_sidebar
permalink: /doc/en/lb4/apidocs.context.inject.context.html
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) > [@loopback/context](./context.md) > [inject](./context.inject.md) > [context](./context.inject.context.md)
## inject.context variable
Inject the context object.
<b>Signature:</b>
```typescript
context: () => (target: Object, member: string, methodDescriptorOrParameterIndex?: number | TypedPropertyDescriptor<any> | undefined) => void
```
## Example
```ts
class MyProvider {
constructor(@inject.context() private ctx: Context) {}
}
```