【发布时间】:2018-10-11 22:32:57
【问题描述】:
如何从 Angular 2 中的 json 对象中获取值?我的对象如下:
这里我想获取 type 的值。
我尝试了以下方法:
console.log("RECORD TYPE IS:"+records.type);
console.log**(records['type'])**;
但它正在打印 undefined。
【问题讨论】:
-
您能否粘贴来自 chrome 开发工具的响应而不是预览选项卡的响应。也可以试试
console.log(typeof records)