New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Can't inject services into module with @Inject #30
Comments
I could track down the error to the module class. addCustomClass(component) {
const { provide: metatype, useClass } = component;
this._components.set(metatype.name, {
name: metatype.name,
metatype: useClass,
instance: null,
isResolved: false,
});
} The incoming metatype is a string and does not have a name property which results in an undefined set entry. I tested around and changed it to the following: addCustomClass(component) {
const { provide: metatype, useClass } = component;
let name = metatype.name;
if (!name) {
name = metatype;
}
this._components.set(name, {
name: name,
metatype: useClass,
instance: null,
isResolved: false,
});
} This is a quick hack but it fixes the problem. Now the injector can resolve the dependency. I guess you'r using the name property if a constructor is given in the provide property of the component? |
Thank you for reporting. Issue is already fixed, please, update package into v. 1.0.3. |
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Hi,
it looks like I'm not able to inject a service into my module when I'm using the @Inject decorator.
Following code is throwing an resolve error:
Error:
The service class is decorated with the @component decorator.
The text was updated successfully, but these errors were encountered: