We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Hello,
If I want to register a value of 0/null/false/empty string, it won't get resolved and it will fail.
Ex: container.register({ token: 'foo', useValue: 0 }); container.resolve('foo') fails
container.register({ token: 'foo', useValue: 0 })
container.resolve('foo')
The problem seems to be in container.ts : registerOne(provider).
container.ts : registerOne(provider)
if (provider.useValue) { registryData.instance = provider.useValue; }
I would suggest replacing it with
if (provider.useValue !== void 0) { registryData.instance = provider.useValue; }
or
if ('useValue' in provider) { registryData.instance = provider.useValue; }
to support undefined values.
Also, maybe check if a provider is valid (has only one of useClass/useValue/useFactory set on something different than undefined).
Thanks
The text was updated successfully, but these errors were encountered:
Hey! Thanks for submitting your bug report! Never thought such use case would come up. I'm gonna fix that today.
Sorry, something went wrong.
Glad to be helpful :)
No branches or pull requests
Hello,
If I want to register a value of 0/null/false/empty string, it won't get resolved and it will fail.
Ex:
container.register({ token: 'foo', useValue: 0 })
;container.resolve('foo')
failsThe problem seems to be in
container.ts : registerOne(provider)
.I would suggest replacing it with
or
to support undefined values.
Also, maybe check if a provider is valid (has only one of useClass/useValue/useFactory set on something different than undefined).
Thanks
The text was updated successfully, but these errors were encountered: