【发布时间】:2017-12-16 17:20:47
【问题描述】:
我对 Angular 和 Typescript 还很陌生,我正在尝试声明一个具有复杂数组的属性作为其属性之一。我的尝试如下所示:
groupedItem: {
customGroupId: string,
cgName: string,
category: [{
customGroupItemId: string,
name: string }]
};
当我尝试访问该属性时
this.groupedItem.category.name
我收到一个错误提示
Property 'name' does not exist on type '[{ customGroupItemId: string; name: string; }]'
它看起来就在那里。我究竟做错了什么?
【问题讨论】:
标签: javascript arrays json angular typescript