首页 > 解决方案 > 错误 TS1238:作为表达式调用时,无法解析类装饰器的签名。角

问题描述

我的项目角度有问题,但我不知道问题出在哪里。我想在我的项目中添加一个服务,我像这样定义这个服务

import {Injectable} from "@angular/core";
import {Http} from "@angular/http";

@Injectable

export class ContactService{

constructor(public http: Http){

}
  getContacts(){
     return this.http.get("http://localhost:8080/findPersons? 
      mc=wa&page=1&size=6").map(resp => resp.json());
}
}

在我的 IDE 的控制台中,我在 src/contact.service/contacts.service.ts(4,1) 中有这个错误:错误 TS1238:当作为表达式调用时,无法解析类装饰器的签名。

我有同样的错误

在此处输入图像描述

有没有人可以帮助我,谢谢:)

标签: angularangular-services

解决方案


改变

@Injectable

@Injectable()

推荐阅读