简体   繁体   English

角度2-未定义标识符

[英]Angular 2 - Identifier is not defined

I've weird problem, my Visual Studio Code marks me an error but there is no error and everything is working well. 我有一个奇怪的问题,我的Visual Studio代码将我标记为一个错误,但没有错误,一切正常。 What's wrong? 怎么了?

在此处输入图片说明

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()));
  }
}

It looks like the editor isn't able to find the component or something like that (unless your component is called 'anonymous'). 看起来编辑器无法找到该组件或类似的东西(除非您的组件被称为“匿名”)。 Have you tried cleaning your code? 您是否尝试过清洁代码?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM