角模块之间的层次结构

时间:2019-07-10 19:56:24

标签: angular dependency-injection module hierarchy

我想从位于共享模块中的抽象类扩展组件。但是,当我尝试在shared.module中导出该类时,在共享模块中收到错误消息: Cannot assign abstract constructor type to a non-abstract constructor type

是否可以这样做,如果答案是肯定的,我该如何完成呢?

这是抽象类:

export abstract class BaseComponent extends SimpleComponent {
    protected _clearHubConnection: HubConnection;
    subscription: any;
    protected programService: ProgramService;
    protected toolbarService: ToolbarService;
    private _clearMethod: string;
    protected _config: ConfigService;

    constructor(data: DataService, programService: ProgramService, httpClient: HttpClient,
        toolbarService: ToolbarService, translateService: TranslateService, config: ConfigService, clearMethodValue?: string) {
        super(data, httpClient, translateService);
    }
}

1 个答案:

答案 0 :(得分:0)

反之亦然:

class SimpleComponent extends BaseComponent

您的简单组件应该是非抽象的,而BaseComponent是抽象的。