【问题标题】:How to allow duplicates in ng-repeat?如何在 ng-repeat 中允许重复?
【发布时间】:2015-10-20 21:14:32
【问题描述】:

我正在使用 stringify 并且 json 正在格式化,并且正在警告它即将到来。但在实际链接中它没有显示。当我签入控制台错误时,出现“在 ng-repeat 中不允许重复密钥”。

谁能告诉如何在 ng-repeat 中允许重复,以便打印格式化的 json。

【问题讨论】:

  • 最好能包含您已经尝试过的内容。

标签: html json angularjs model-view-controller angularjs-ng-repeat


【解决方案1】:

将“track by $index”添加到中继器。

https://docs.angularjs.org/error/ngRepeat/dupes

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2021-12-26
    • 1970-01-01
    • 2014-01-18
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多