Container.set()
method, there are three options available that must be set. Either one of the following are allowed: type
, factory
, or value
but not more than one.Container.set({ id: ExampleClass, type: ExampleClass});
Container.set({ id: ExampleClass, value: new ExampleClass});
Container.set({ id: ExampleClass, factory: ExampleClass});
type
due to the fact that using value
will instantiate the class before it's registered to the TypeDI Container. Using type
will also assure that the TypeDI Container is injected to the constructor.