I am working on a angular project.
I tried multiple inheritance.
@Injectable({
providedIn: 'root'
})
export class StoreStaffDesignationService extends StoredDataService<IStoreStaffDesignation> {
constructor(
public override http: HttpClient,
) {
super('staff-designation', http);
}
}
@Injectable({
providedIn: 'root'
})
export class StoredDataService<T> extends HttpService<T> {
constructor(public subPath: string, public override http: HttpClient) {
super('store' + '/' + subPath, http);
this.subPath = subPath;
}
}
@Injectable({ providedIn: 'root' })
export class HttpService<T> {
protected baseUrl: string;
protected basePath: string;
http: HttpClient;
constructor(basePath: string, http: HttpClient) {
this.baseUrl = `${environment.BASE_URL}`;
this.basePath = basePath;
this.http = http;
}
}
I got complie failed with
error NG2003: No suitable injection token for parameter 'subPath' of class 'StoredDataService'. Consider using the @Inject decorator to specify an injection token.
NG2003: No suitable injection token for parameter 'basePath' of class 'HttpService'. Consider using the @Inject decorator to specify an injection token.
What is the mistake in my code?
Any one help me please.