I have a Base Component called ListComponent and a ParentComponent named Businesses2ListComponent. The concept is to have multiple types of Lists with tables that all stem from the ListComponent. This requires passing the correct service accordingly.
In this scenario, I need to pass the BusinessService (which is an extension of BaseService) to the BaseComponent.
Here's the structure of the ListComponent:
@Component({
selector: 'app-list',
templateUrl: './list.component.html',
styleUrls: ['./list.component.scss']
})
export class ListComponent<S extends BaseService<T, L>, T, L> implements OnInit {
constructor(private viewContainerRef: ViewContainerRef,
private domElement: ElementRef,
private ngForage: NgForage,
private route: ActivatedRoute,
private router: Router,
private injector: Injector,
private dataService: S) {
}
}
This is the definition of my Business2ListComponent:
@Component({
selector: 'app-businesses2-list',
templateUrl: './businesses2-list.component.html',
styleUrls: ['./businesses2-list.component.scss']
})
export class Businesses2ListComponent extends ListComponent<BusinessService, Business, BusinessList> implements OnInit {
constructor(viewContainerRef: ViewContainerRef,
domElement: ElementRef,
ngForage: NgForage,
dataService: BusinessService,
route: ActivatedRoute,
router: Router,
injector: Injector) {
super(viewContainerRef, domElement, ngForage, route, router, injector, dataService);
}
ngOnInit() {
}
}
Upon trying to execute this setup, I encountered errors: https://i.sstatic.net/n9dVO.png https://i.sstatic.net/dJ9e7.png
I suspect the issue lies in the final argument, but what other approach should I consider?