# registerValue Function
Module | import { registerValue } from "@tsed/di" |
---|---|
Source | /packages/di/src/registries/ProviderRegistry.ts |
# Overview
const registerValue: (provider: any | IProvider<any>, value?: any) => void;
# Description
Add a new value in the ProviderRegistry
.
# Example with symbol definition
import {registerValue, InjectorService} from "@tsed/common";
const MyValue = Symbol.from("MyValue")
registerValue(MyValue, "myValue");
@Service()
export class OtherService {
constructor(@Inject(MyValue) myValue: string){
console.log(myValue); /// "myValue"
}
}
1
2
3
4
5
6
7
8
9
10
11
12
2
3
4
5
6
7
8
9
10
11
12
- 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