【发布时间】:2019-07-27 23:42:47
【问题描述】:
如何访问 typescript 中的 JSON 属性?
我正在制作 Angular 项目。
`
test:string;
response:any;
web_assign() {
this.http.get(this.url1).subscribe( e => this.response = e);
this.test = "OK";
this.t=this.response.name2;
return false;}
它在这一行给出错误。
this.t=this.response.name2;
它说它无法读取'name2'的属性
【问题讨论】:
标签: json typescript angular7