簡體   English   中英

角度2-未定義標識符

[英]Angular 2 - Identifier is not defined

我有一個奇怪的問題,我的Visual Studio代碼將我標記為一個錯誤,但沒有錯誤,一切正常。 怎么了?

在此處輸入圖片說明

export class HomeComponent {
  public ElectronicList = [];
  public LaptopList = [];
  public constructor(
    private electronic: DatabaseService,
    private laptop: DatabaseService
  ) {
    this.electronic
      .getElectronicList()
      .subscribe((data: Response) => (this.ElectronicList = data.json()));

    this.laptop
      .getLaptopList()
      .subscribe((data: Response) => (this.LaptopList = data.json()));
  }
}

看起來編輯器無法找到該組件或類似的東西(除非您的組件被稱為“匿名”)。 您是否嘗試過清潔代碼?

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM