以下是我创建的服务:
HttpSiteLangService.ts
@Injectable({providedIn: 'root'})
export class HttpSiteLangService extends HttpSiteService<SiteLangConfigEntity> {...
HttpSiteService.ts
@Injectable({providedIn: 'root'})
export class HttpSiteService<E> extends HttpApiConfigService<E> {...
HttpApiConfigService.ts
@Injectable({providedIn: 'root'})
export class HttpApiConfigService<E> extends HttpApiService {...
HttpApiService.ts
@Injectable({providedIn: 'root'})
export class HttpApiService {
constructor(private httpClient: HttpClient) {
}
...
然后我尝试将HttpSiteLangService注入组件:
export class SiteLangListComponent implements OnInit {
constructor(public httpService: HttpSiteLangService) {
console.log(httpService)
}
...
但是注入是HttpApiService,而不是HttpSiteLangService console log image