5

Let's say I have a JSON like this:

{
    "A": [
            {"name": "Aa", "count": "21"},
            {"name": "Ab", "count": "54"}
         ],

    "B": [
            {"name": "Ba", "count": "30"},
            {"name": "Bb", "count": "22"}
         ],

    "C": [
            {"name": "Ca", "count": "40"},
            {"name": "Cb", "count": "33"}
         ],
}

Output HTML should like this:

[A]
Aa 21
Ab 54

[B]
Ba 30
Bb 22

[C]
Ca 40
Cb 33

How can I iterate using angular2 Beta version?

1 Answer 1

3

You can use the ng-for directive.

Have a look at this. angular-2-ng-for-syntax

And you should convert your object to an array. Have a look here: a-better-way-to-convert-js-object-to-array

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.