【发布时间】:2018-07-12 11:09:52
【问题描述】:
我尝试创建一个非常基本的类,但由于某种原因,我无法弄清楚为什么这个变量“不存在”
export class AppModule {
public static currentHost: string = 'http://localhost:8080/';
constructor() {
if (window.location.hostname == "localhost") {
this.currentHost = "http://" + window.location.hostname + "/";
}
}
}
ERROR in src/app/app.module.ts(62,12): error TS2339: Property 'currentHost' does not exist on type 'AppModule'.
有人看到我的错误吗?
【问题讨论】:
标签: angular typescript angular5