Comment on page
Variable binding (Injection)
@Inject(MyService) private myService:MyService
@Inject("MyService") private myService:MyService
constructor(private myService:MyService)
The InversifyJS container is handling and storing singleton objects.
The container is stored on the server instance, each request and the
ServerContainerService
Check the previous section (Dynamic injectables)
After retrieving the container we able to get the service instance as following:
private myService:MyService = container.get(MyService)
private myService:MyService = container.get("MyService")
Last modified 4yr ago