无法访问对象数组中的Object属性

时间:2017-02-03 22:06:50

标签: javascript angularjs object

你们不喜欢我的上一个问题,所以我想要更清楚。

我有一个名为result的对象,它是一个100的数组:

enter image description here

<div id="one"></div>
<div id="two"></div>

为了清晰起见,我转换为JSON。如您所见,有一个名为UpdatedGPI的数组。

当你打开那个数组时,它有100个对象。

我正在尝试迭代,但它只是错误输出:

  

(错误:result.UpdatedGpi未定义)

代码:

{
"id":2,
"name":null,
"description":null,
"tableName":null,
"displayId":0,
"itemNameFieldId":0,
"itemPkFieldId":0,
"dropDownInd":false,
"items":null,
"itemAttrs":null,
"updatedItems":null,
"updatedGpi":[
  {
  "GPI":"11000010002105",
  "THER_CLASS_DESC":"Amphotericin B For Inj 50 MG",
  "GENERIC_NAME":"*Antifungals**"
  },
  {
  "GPI":"11000010101910",
  "THER_CLASS_DESC":"Amphotericin B Cholesteryl Sulfate Complex For Inj 50 MG",
  "GENERIC_NAME":"*Antifungals**"
  },
  {
  "GPI":"11000010101920",
  "THER_CLASS_DESC":"Amphotericin B Cholesteryl Sulfate Complex For Inj 100 MG",
  "GENERIC_NAME":"*Antifungals**"
  },
  {
  "GPI":"11000010301820",
  "THER_CLASS_DESC":"Amphotericin B Lipid Inj Susp (For IV Infusion) 5 MG/ML","GENERIC_NAME":"*Antifungals**"},{"GPI":"11000010401920","THER_CLASS_DESC":"Amphotericin B Liposome IV For Susp 50 MG","GENERIC_NAME":"*Antifungals**"},{"GPI":"11000020000105","THER_CLASS_DESC":"Flucytosine Cap 250 MG","GENERIC_NAME":"*Antifungals**"},{"GPI":"11000020000110","THER_CLASS_DESC":"Flucytosine Cap 500 MG","GENERIC_NAME"[…]

如何访问UpdatedGpi对象并迭代它们?

0 个答案:

没有答案