Skip to content

Commit e3601f0

Browse files
authored
Constructor injection simpler
Looks like it's already working this way. It's angular-like, with less code. Is it ok ?
1 parent 450573e commit e3601f0

File tree

1 file changed

+3
-9
lines changed

1 file changed

+3
-9
lines changed

README.md

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -126,15 +126,9 @@ class WaterFactory {
126126
@Service()
127127
class CoffeeMaker {
128128

129-
private beanFactory: BeanFactory;
130-
private sugarFactory: SugarFactory;
131-
private waterFactory: WaterFactory;
132-
133-
constructor(beanFactory: BeanFactory, sugarFactory: SugarFactory, waterFactory: WaterFactory) {
134-
this.beanFactory = beanFactory;
135-
this.sugarFactory = sugarFactory;
136-
this.waterFactory = waterFactory;
137-
}
129+
constructor(private beanFactory: BeanFactory,
130+
private sugarFactory: SugarFactory,
131+
private waterFactory: WaterFactory) {}
138132

139133
make() {
140134
this.beanFactory.create();

0 commit comments

Comments
 (0)