How can I print json array in Angular 4?

Leyli Abbasova

This is how json looks like:

--------------------------------------------------
    "id": 2,
        "user": {
            "id": 1,
            "name": "User",
            "surname": "User",
            "email": "[email protected]"
        },
        "host": {
            "id": 1,
            "name": "Azza"
        },
        "products": [
            {
                "id": 3,
                "name": "Desert Tiramisu",
                "price": "2.40",
                "media_ids": "3,4",
                "quantity": 1
            }
        ],
-------------------------------------------------

HTML part:

  <div *ngFor="let item of active_orders">
    <div class="row">
      <div class="col-md-12">
        <div class="col-md-4">
          <h4>
            {{item.products.name}}
          </h4>
        </div>
      </div>
    </div>
  </div>

I want to print products'name (for example in our case "Desert Tiramisu"). But I don't get any results. Where are my mistakes?

Sajeetharan

You need to have nested ngFor since products is an array

  <div *ngFor="let item of active_orders">
    <div class="row">
      <div class="col-md-12">
        <div class="col-md-4"  *ngFor="let detail of item.products">
          <h4>
            {{detail.name}}
          </h4>
        </div>
      </div>
    </div>
  </div>

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

How can I print my array in a certain way?

From Dev

How can I print 4 bytes as an integer

From Dev

How can I compare array value and print it if matches?

From Dev

How can i print a database query to a javascript array?

From Dev

How can I print an integer number displaying 4 decimal digits?

From Dev

How can I print a multidimensional array in Perl?

From Dev

How can I print the contents of an array alongside it's position?

From Dev

How can I return a char array and print it in main?

From Dev

How can i print my array and my histogram on the same line?

From Dev

How can I print the lowest key of an array?

From Dev

How can I print the value of the lowest key of an array?

From Dev

How can I print array in Assembly

From Dev

How can I print an associative array as a matrix

From Dev

How can I print text with spaces from array?

From Dev

How can I print multiple elements from an array inJavaSCript?

From Dev

How can I print a one dimensional array as grid in Python?

From Dev

How can I print all content of an array in one line?

From Dev

How can I set a specific set of numbers in an array/matrix to print?

From Dev

How can I print this?

From Dev

How can I print 4 bytes as an integer

From Dev

How can I compare array value and print it if matches?

From Dev

How can i print json objects and array values?

From Dev

How can I print a String array with reflection with quotation marks in java

From Dev

How can I print the lowest key of an array?

From Dev

Print the JSON in angular js, I can see in console, but not able to print the same

From Dev

How can I save an array to UserDefaults, and then retrieve that array and print

From Dev

how I can print an array as a vector form

From Dev

Angular 4 | How can i control the display of a div in angular 4?

From Dev

How can I use phaser with angular 4

Related Related

  1. 1

    How can I print my array in a certain way?

  2. 2

    How can I print 4 bytes as an integer

  3. 3

    How can I compare array value and print it if matches?

  4. 4

    How can i print a database query to a javascript array?

  5. 5

    How can I print an integer number displaying 4 decimal digits?

  6. 6

    How can I print a multidimensional array in Perl?

  7. 7

    How can I print the contents of an array alongside it's position?

  8. 8

    How can I return a char array and print it in main?

  9. 9

    How can i print my array and my histogram on the same line?

  10. 10

    How can I print the lowest key of an array?

  11. 11

    How can I print the value of the lowest key of an array?

  12. 12

    How can I print array in Assembly

  13. 13

    How can I print an associative array as a matrix

  14. 14

    How can I print text with spaces from array?

  15. 15

    How can I print multiple elements from an array inJavaSCript?

  16. 16

    How can I print a one dimensional array as grid in Python?

  17. 17

    How can I print all content of an array in one line?

  18. 18

    How can I set a specific set of numbers in an array/matrix to print?

  19. 19

    How can I print this?

  20. 20

    How can I print 4 bytes as an integer

  21. 21

    How can I compare array value and print it if matches?

  22. 22

    How can i print json objects and array values?

  23. 23

    How can I print a String array with reflection with quotation marks in java

  24. 24

    How can I print the lowest key of an array?

  25. 25

    Print the JSON in angular js, I can see in console, but not able to print the same

  26. 26

    How can I save an array to UserDefaults, and then retrieve that array and print

  27. 27

    how I can print an array as a vector form

  28. 28

    Angular 4 | How can i control the display of a div in angular 4?

  29. 29

    How can I use phaser with angular 4

HotTag

Archive