Open djindjic opened 9 years ago
Though this feature is possible and convenient, the workaround (and possibly better solution) is to supply these extra parameters through provided dependencies. For example:
import {Inject, Provide} from 'di';
import {Pump} from './pump';
class CoffeeType {}
@Inject(Pump, CoffeeType)
export class CoffeeMaker {
constructor(pump, coffeeType) {
this.pump = pump;
this.coffeeType = coffeeType;
}
}
@Provide(CoffeeType)
function Cappuccino() {
return 'cappuccino';
}
let injector = new Injector();
let withCappucino = injector.createChild([Cappuccino]);
let coffeeMaker = withCappucino.get(CoffeeMaker);
Is possible (and is it relevant question for this repo issues) to have some additional constructor parameter which is not injected module itself? For example coffee_type: