# Inject Decorator
Module | import { Inject } from "@tsed/di" |
---|---|
Source | /packages/di/src/decorators/inject.ts |
# Overview
function Inject(symbol?: any): Function;
# Description
Inject a provider to another provider.
Use this decorator to inject a custom provider on constructor parameter or property.
@Injectable()
export class MyService {
@Inject(CONNECTION)
connection: CONNECTION;
}
1
2
3
4
5
2
3
4
5
- Session & cookies
- Passport.js
- TypeORM
- Mongoose
- GraphQL
- Socket.io
- Swagger
- AJV
- Multer
- Serve static files
- Templating
- Throw HTTP Exceptions
- Customize 404
- AWS
- Jest
- Seq
- Controllers
- Providers
- Model
- Converters
- Middlewares
- Pipes
- Interceptors
- Authentication
- Hooks
- Injection scopes
- Custom providers
- Custom endpoint decorator
- Testing