在Angularjs中迭代JSON字符串

在Angularjs中迭代JSON字符串,json,angularjs,rest,Json,Angularjs,Rest,我正在托管一个公开RESTAPI的web服务器。下面是我从服务器得到的JSON响应 [ { "score": 4, "sense": "be the winner in a contest or competition; be victorious; \"He won the Gold Medal in skating\"; \"Our home team won\"; \"Win the game\"" }, { "score": 2, "sense": "wi

我正在托管一个公开RESTAPI的web服务器。下面是我从服务器得到的JSON响应

[
{
    "score": 4,
    "sense": "be the winner in a contest or competition; be victorious; \"He won the Gold Medal in skating\"; \"Our home team won\"; \"Win the game\""
},
{
    "score": 2,
    "sense": "win something through one's efforts; \"I acquired a passing knowledge of Chinese\"; \"Gain an understanding of international finance\""
},
{
    "score": 0,
    "sense": "obtain advantages, such as points, etc.; \"The home team was gaining ground\"; \"After defeating the Knicks, the Blazers pulled ahead of the Lakers in the battle for the number-one playoff berth in the Western Conference\""
},
{
    "score": 4,
    "sense": "attain success or reach a desired goal; \"The enterprise succeeded\"; \"We succeeded in getting tickets to the show\"; \"she struggled to overcome her handicap and won\""
    }
]
我想在列表中显示这个。我以以下方式使用材料设计:

<md-list data-ng-repeat="item in sensesscores track by $index">
    <md-item-content>
    <div class="md-tile-content">
        {{item.sense}}
    </div>
    <div class="md-tile-left">
        {{item.score}}
    </div>
    </md-item-content>

</md-list>
我确保能够在“SenseScores”中获取数据,并将其打印在屏幕上。但是,我无法将其解析并显示在列表中。提前谢谢

编辑


我修改了代码以更正语法并将ng向上移动到继承人身份,但仍然不起作用。但是,我在另一个JSON文件上尝试了它,这很有效

[{
"sense": "sensaS,NF,ASNGD.,AD., BVAS.,GMDN,FG e1",
"score" : 5
},
{
"sense": "sen ASG SFG S H D GD FJDF JDF J GFJ FDFGse2",
"score" : 13
}
,
{
"sense": "sen ASG SFG S H D GD FJDF JDF J GFJ FDFGse2",
"score" : 1
},
{
"sense": "sen ASG SFG S H D GD FJDF JDF J GFJ FDFGse2",
"score" : 0
},
{
"sense": "sen ASG SFG S H D GD FJDF JDF J GFJ FDFGse2",
"score" : 3
},
{
"sense": "sen ASG SFG S H D GD FJDF JDF J GFJ FDFGse2",
"score" : 2
},
{
"sense": "sen ASG SFG S H D GD FJDF JDF J GFJ FDFGse2",
"score" : 1
}
]

我不明白JSON响应有什么问题。

您的HTML有许多拼写错误,下面的格式正确:

<md-list>
    <md-item data-ng-repeat="item in sensesscores track by $index">
       <md-item-content>
         <div class="md-tile-content">
            {{item.sense}}
         </div>
         <div class="md-tile-left">
            {{item.score}}
         </div>
       </md-item-content> // this tag was not closed, but rather a new opener
   </md-item>
</md-list> // this tag was not closed properly, missing ">"

{{item.sense}
{{item.score}
//这个标签不是关闭的,而是一个新的开始
//此标记未正确关闭,缺少“>”

更改它,您的数据将按预期显示。

我找到了解决方案。需要将内容转换为json对象,我使用jquery-$.parseJSON(data)

这样做了。我想指出的是,ng repeat应该是项目上方层次结构中的一个级别,它们永远不会以这种方式显示,请将它们向下移动一个级别
<md-list>
    <md-item data-ng-repeat="item in sensesscores track by $index">
       <md-item-content>
         <div class="md-tile-content">
            {{item.sense}}
         </div>
         <div class="md-tile-left">
            {{item.score}}
         </div>
       </md-item-content> // this tag was not closed, but rather a new opener
   </md-item>
</md-list> // this tag was not closed properly, missing ">"