问题描述:

i get array from json file using $http.get looking like this:

{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 "}}

im trying to put all values in three columns table but i cant figure out how to get all of them:

best attempt got only script_id's and cron_format's:

 <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>

tried to do the same in both data and row but it didnt work cause than i have the row var....any solution please?

网友答案:

You're quite close - the ng-repeat directive in your tbody element should look like:

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

That will map the top-level keys in your object to user_id, which from your question is what I think you want.

相关阅读:
Top