I am trying to build an application with Angular 6 and I am still setting everything up. But it seems there is something wrong with the dependency injection in my app.
I also experienced the same issue with Angular 8.2.13 + Typescript. Finally the trick was to use a @Inject('RefOnlyUsedForTesting')
, even if the type is string
.
export abstract class MyBaseClass {
....
constructor(@Inject(ElementRef) elementRef: ElementRef,
@Optional() @Inject('RefOnlyUsedForTesting') dep1: MyObject,
@Optional() @Inject('RefOnlyUsedForTesting') dep2: string,
@Optional() @Inject('RefOnlyUsedForTesting') dep3: string) {
super();
...
}
}