gpt4 book ai didi

javascript - ng重复: dupes ERROR on simple JSON

转载 作者:行者123 更新时间:2023-11-28 04:16:29 25 4
gpt4 key购买 nike

我可能在这里遗漏了一些明显的东西,但我认为这应该简单地循环我提供的 JSON。但是,我收到 ngRepeat:dupes 错误,指出 uid 未定义。如果我不通过 ID 进行跟踪,则会收到重复错误。尽管我在 Controller 中进行解析,但该字符串似乎没有被视为 JSON,而是一个简单的字符串。我在这里缺少什么?

<tbody>
<tr ng-repeat="item in monresults track by item.uid">
<td>{{item.date}}</td>
<td>{{item.name}}</td>
<td><a href="{{item.url}}"><button type="button" class="btn btn-warning btn-sm btn-block">Play Call <i class="fa fa-volume-up" aria-hidden="true"></i></button></a></td>
</tr>
</tbody>

我的 JSON 如下所示:

[   {      "uid":"2",      "name":"Saturday 8-5",      "url":"http://example.com/calls/sat-8-5-17.mp3",      "cs4000id":"hea654hdf!iDk1sjPz8dsa",      "date":"08-05-17",      "created":"2017-08-21 09:44:16",      "emp":""   },   {      "uid":"3",      "name":"Saturday 8-12",      "url":"http://example.com/calls/sat-8-12-17.mp3",      "cs4000id":"5PR$NTuMbFq8x!k1sjPz86Nk",      "date":"08-12-17",      "created":"2017-08-21 09:45:06",      "emp":""   }]

Here is monresults in my CTRL and I'm logging the the results to make sure it looks right:

    Data.get('moncall').then(function (results) {
$scope.monresults = JSON.parse(results);
console.log($scope.monresults);
});

最佳答案

我最终错误地对 JSON 响应进行了双重编码 - 谢谢

关于javascript - ng重复: dupes ERROR on simple JSON,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45804165/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com