2015-02-09 108 views
1

我得到使用$從JSON文件陣列http.get看起來像這樣: {USER_ID:{SCRIPT_ID,cron_format ...}越來越多維數值數組

{"1":{"1":"*\/3 * * * *","2":"*\/6 * * * *","3":"*\/3 * * * *","4":"* * * * *"}, 
"2":{"1":"*\/3 * * * *","2":"*\/2 * * * *","3":"*\/Al test","4":"* * * * *"}, 
"3":{"1":"*\/3 * * * *","2":"*\/6 * * * *","3":"*\/3 * * * *","4":"12 "}} 

我嘗試把所有分三路表中的值,但我無法弄清楚如何讓所有的人: 最好的嘗試只得到了SCRIPT_ID的和cron_format的:

<table class="table table-bordered table-hover"> 
     <thead> 
      <td>user name</td> 
      <td>script id</td> 
      <td>cron format</td> 
     </thead> 
     <tbody ng-repeat="row in data"> 
      <tr ng-repeat="(script_id, cron_format) in row"> 
       <td>{{user_id}}</td> 
       <td>{{script_id}}</td> 
       <td>{{cron_format}}</td> 
      </tr> 
     </tbody> 
    </table> 

試圖做同樣的數據和行,但它沒有工作的原因不是我有行var ...請任何解決方案?

+0

你能舉一個例子,說明你的示例json數據的輸出行是什麼......這將幫助我們弄清楚你如何試圖映射這些數據。 – JRulle 2015-02-09 20:56:55

回答

1

你是相當接近 - 在ng-repeat指令在tbody元素應該是這樣的:

<tbody ng-repeat="(user_id, row) in data"> 

這會在你的對象頂層鍵映射到user_id,從你的問題是什麼,我認爲你要。