1

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?

1
  • Can you show an example of what the output row for your sample json data would be... this will help us figure out how you are trying to map this data. Commented Feb 9, 2015 at 20:56

1 Answer 1

1

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.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.