How can I use AngularJS 1 to create table rows with the attributes of an array of objects?

Friso

So far I've only found examples that put the objects in the rows (1)(2)(3), but I need to put the objects in the columns and their attributes in the rows.

Example of JSON:

[
  {
    name: 'peanut butter',
    price: 0.99
  }
  {
    name: 'strawberry jelly',
    price: 0.99
  }
  {
    name: 'white bread',
    price: 2.99
  }
]

Example of desired table:

table that shows a row for name and a row for price, with peanut butter, strawberry jelly and white bread and their prices in the columns

Konrad Klimczak

I think you want something like this.

Angular template:

<table>
  <tr>
    <th>Name</th>
    <th ng-repeat="item in yourList">{{ item.name }}</th> 
  </tr>
  <tr>
    <td>Price</td>
    <td ng-repeat="item in yourList">{{ item.price }}</td> 
  </tr>
</table>

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

C# How can I compare objects' attributes that are elements of an array?

From Dev

how can i create a table for this array?

From Dev

How can I use the rows of a table as the name of a new table

From Dev

How can I use an AngularJS filter to select rows from a range?

From Dev

How can I avoid "strange" rows when create a table?

From Dev

How can I select a part of rows and create a new table in HBase?

From Dev

How Can I Dynamically Create Table Rows From A List Of Records?

From Dev

How can I create an array from the values of DOM elements with AngularJS?

From Dev

How can i use table row id as parameter for angularjs function

From Dev

How can I use PHP implode on an array of objects

From Dev

How can I create a table with same attributes of a View another system delivers me?

From Dev

How can I create a decorator for a set of models with use the same table?

From Dev

How can I use awk to create a table from a gpx file

From Dev

In shiny How to create a DT table, where i can add rows and delete the rows simultaneously

From Dev

How can I use `defineProperty` to create a readonly array property?

From Dev

Using a loop counter how can I dynamically create objects and use the counter in naming the objects?

From Dev

How can I get the number of rows in an Excel pivot table for use outside the pivot table?

From Dev

How to create an array of image objects to use in a FOR loop?

From Dev

How can I retrieve all Objects in a List that have certain attributes?

From Dev

How can I code correctly to keep unique attributes in separate objects

From Dev

Can I use this in AngularJS {{ array [ {{index }} ] }}?

From Dev

How can I use VBA to get STDEV of the values for different types of objects listed in multiple rows?

From Dev

How do I create and recall class objects from a resource file that I can use at runtime?

From Dev

How do I create an array of objects in json?

From Dev

How do I create an Array of Objects in C?

From Dev

How can I dynamically create rows in Jade?

From Dev

How can I dynamically add table rows

From Dev

how can i collapse all table rows

From Dev

How can I average table rows by timestamp?

Related Related

  1. 1

    C# How can I compare objects' attributes that are elements of an array?

  2. 2

    how can i create a table for this array?

  3. 3

    How can I use the rows of a table as the name of a new table

  4. 4

    How can I use an AngularJS filter to select rows from a range?

  5. 5

    How can I avoid "strange" rows when create a table?

  6. 6

    How can I select a part of rows and create a new table in HBase?

  7. 7

    How Can I Dynamically Create Table Rows From A List Of Records?

  8. 8

    How can I create an array from the values of DOM elements with AngularJS?

  9. 9

    How can i use table row id as parameter for angularjs function

  10. 10

    How can I use PHP implode on an array of objects

  11. 11

    How can I create a table with same attributes of a View another system delivers me?

  12. 12

    How can I create a decorator for a set of models with use the same table?

  13. 13

    How can I use awk to create a table from a gpx file

  14. 14

    In shiny How to create a DT table, where i can add rows and delete the rows simultaneously

  15. 15

    How can I use `defineProperty` to create a readonly array property?

  16. 16

    Using a loop counter how can I dynamically create objects and use the counter in naming the objects?

  17. 17

    How can I get the number of rows in an Excel pivot table for use outside the pivot table?

  18. 18

    How to create an array of image objects to use in a FOR loop?

  19. 19

    How can I retrieve all Objects in a List that have certain attributes?

  20. 20

    How can I code correctly to keep unique attributes in separate objects

  21. 21

    Can I use this in AngularJS {{ array [ {{index }} ] }}?

  22. 22

    How can I use VBA to get STDEV of the values for different types of objects listed in multiple rows?

  23. 23

    How do I create and recall class objects from a resource file that I can use at runtime?

  24. 24

    How do I create an array of objects in json?

  25. 25

    How do I create an Array of Objects in C?

  26. 26

    How can I dynamically create rows in Jade?

  27. 27

    How can I dynamically add table rows

  28. 28

    how can i collapse all table rows

  29. 29

    How can I average table rows by timestamp?

HotTag

Archive