-
Notifications
You must be signed in to change notification settings - Fork 726
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
Add ability to unbind a specific class #1035
Comments
Did you find a workaround? |
As this was not too big of an issue for my use case, i simply ignored the problem. |
You could use ContainerModule and unload, but this is better. Note that it has not been carefully considered, but works for your example. It relies upon the internal binding dictionary. rebindContainer.ts
|
I propose adding the ability to unbind a specific class from any previously bound interface.
If for example some project I depend on already binds the classes
Katana
andShuriken
to the interfaceWeapon
, whereas I only want a multiinject to inject theKatana
and other self-defined weapons and not shurikens, because they are just too sneaky.Expected Behavior
I unbind the shuriken from the weapon interface and bind a new weapon.
When using multiinject on the
Weapon
class only theKatana
and my new weapon should be in the injected objects.Current Behavior
unbind
unbinds all previously defined classes from the interface and only my new defined weapon would be in the multiinjected list.Possible Solution
The project I depend on already binds like this:
bind(Katana).to(Weapon)
bind(Shuriken).to(Weapon)
Add some new syntax to allow this:
unbind(Shuriken).from(Weapon)
bind(Hammer).to(Weapon)
The text was updated successfully, but these errors were encountered: