angular - 错误 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:当作为表达式调用时,无法解析类装饰器的签名。
我有同样的错误
有没有人可以帮助我,谢谢:)
解决方案
改变
@Injectable
至
@Injectable()
推荐阅读
- python - 使用 Visual Studio Code 进行调试时如何设置 Python 解释器选项?
- regex - 具有多个选项的 PowerShell RegEx
- mysql - 权限被拒绝 @ rb_sysopen - /tmp/github_api_headers20180618-21004-yrr75i 错误。
- python - 尝试在 CherryPy 服务器上部署 Flask 应用程序
- javascript - 收到未经授权的错误
- kubernetes - Kubernetes 持续部署
- javascript - 在 React 中实现硬重载
- asp.net - HTTP 请求被记录为 HTTPS 并且不会重定向
- ios - 无法将“UITableViewCellContentView”(0x111d61280)类型的值转换为“UIImageView”(0x111d4cdd0)
- regex - 使用 Scala 正则表达式从文本中提取 9+.9* 格式的数字