angular6繼承類注意幾點:

1:寫成這樣

export class aextends bimplements OnInit {

}

2:在引入服務依賴的時候寫成這樣

constructor(public technicalProductsService: TechnicalProductsService) {
    super(technicalProductsService);
}

3:b類的屬性在a類重新定義的時候應該在a類的constructor函數裏面使用this改寫

constructor(public technicalProductsService: TechnicalProductsService) {

    super(technicalProductsService);

    this.articleClassify = 4;

  }
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章