带有@injectable和普通参数的Typescript构造函数

时间:2018-06-13 19:47:06

标签: typescript

我正在尝试这样做:

export class TypedService {
    protected baseUrl: string;

    constructor(section: string, protected http: HttpClient) {
        this.baseUrl = `${environment.apiUri}/${section}`;
    }

其中intent是子类将调用构造函数并将section传递给baseUrl。但是,这样做会失败,因为它希望子类也传递http参数。

基类是否可以注入这样的值,但仍然有子类传递值?

0 个答案:

没有答案
相关问题