Closed OmarOufDev closed 6 years ago
const optionsVerification = new OptionsVerification({enabled: "false"}).validate();
does not invoke anything in inversify. For the dependencies to be fulfilled you need to get the optionsVerification from the container.
Try
const optionsVerification = myContainer.get< IOptionsVerification >(TYPES. IOptionsVerification);
trying to inject a component as a property . works in a file. just not the other( the injected property is undefined. ) I used the example on the readme of inversifyJS. and kept adding my module file by file while making sure everything is still running. when i added "Utilities" it gets injected properly in 1 file but not the other. not sure why.
sorry for the formating. tried as best as i could.
Steps to Reproduce (for bugs)
the file that injection works in. when i call util() . this.utilities ( is defined ).
file where inject results in an undefined component
bootfile just for testing.
TYPES file.
inversify.config.file
package.json
Your Environment
Stack trace
TypeError: Cannot read property 'for' of undefined at OptionsVerification.validate (E:\TypescriptTutorial\InversifyExmapleInject\Logic\OptionsVerification.js:19:24) at Object. (E:\TypescriptTutorial\InversifyExmapleInject\boot.js:10:95)
at Module._compile (module.js:643:30)
at Object.Module._extensions..js (module.js:654:10)
at Module.load (module.js:556:32)
at tryModuleLoad (module.js:499:12)
at Function.Module._load (module.js:491:3)
at Function.Module.runMain (module.js:684:10)
at startup (bootstrap_node.js:187:16)
at bootstrap_node.js:608:3