如何显示在angularjs一个JSON文件中的数据? [英] How to display data from a json file in angularjs?

查看:497
本文介绍了如何显示在angularjs一个JSON文件中的数据?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个JSON像这样

I have a json something like this

{
 "count": 67,
 "0": {
    "id": "2443",
    "name": "Art Gallery",
    "category": {
        "id": "2246",
        "name": "Gifts & Memories"
    },
   "deckLocation": [
      {
        "id": "2443",
        "deck": {
          "deckNo": "7",
          "deckName": "Promenade "
        },

      }
    ]
},
"1": {
  "id": "7198",
  "name": "Captain's Circle Desk",
  "category": {
    "id": "352",
    "name": "Other Services"
  },
  "deckLocation": [
    {
      "id": "7198",
      "deck": {
        "deckNo": "7",
        "deckName": "Promenade "
      },

    },
    {
      "id": "7198",
      "deck": {
        "deckNo": "7",
        "deckName": "Promenade "
      },

    }
   ]
 }
}

我想显示所有名称是0,1的数组内。我能够列出一个特定的名称,但不是全部。拳头名字会显示这是我写在下面code。但我需要动态地显示所有0,1,2,3等名称。

I want to display all names which is inside the "0", "1" array. I can able to list a specific name but not all. The fist name will display which I written in the following code. But I need to display all 0, 1, 2, 3 etc names dynamically.

data[0].name

请帮助我。
谢谢你。

Please help me. Thank you.

推荐答案

使用NG-复读功能来做到这一点。

use ng-repeat function to do so.

<div ng-repeat = "names in data">
<P>{{names.name}}</P>
</div>

这篇关于如何显示在angularjs一个JSON文件中的数据?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆