ng-repeat不允许我访问JSON数据

时间:2016-02-10 13:22:02

标签: javascript angularjs json angularjs-ng-repeat

我有一个引发重复错误的json。我的json看起来像:

    //console.log(json) shows it as 
    Object{
      IsCanceled: false
      IsCompleted: true
      Results: "{"folders": [{"name": "Hello", "age": 21},{"name": "World","age": 25}]}"
     }

我试过了:

   //No error happen with this one but no data shows up as well
   <tr ng-repeat="f in Results.folders">
     <td>
      {{f.name}}
     </td> 
   </tr>

此外:

  <tr ng-repeat="f in Results">
    <td ng-repeat="s in f.folders">
     {{s.name}}
     </td> 
   </tr>

另外:

 //Considering all names are different 
 <tr ng-repeat="f in Results.folders track by f.name">
    <td>
      {{f.name}}
    </td> 
 </tr>

所有这些都抛出了ng-repeat duplicates错误,我无法弄清楚原因。

错误消息: 错误:[ngRepeat:dupes]不允许在转发器中重复。使用'track by'表达式指定唯一键。 Repeater:s in sc.scans.Result,Duplicate key:string:“,Duplicate value:”

0 个答案:

没有答案