I tried to get dynamic data from server to angular table but it's displaying only first row

vignesh bv

I tried to get dynamic data from server to angular table but it's displaying only first row

i attached the json structure with the code

component.ts

values:any[];

this._userService.get_user_details(this._user.role_name)
    .subscribe(
        (data: any[]) => {
          console.log('send');
      console.log(data);
      this.values=data;
    }
)

Service

get_user_details(role: string){
    return this.httpClient.post('/dashboard/api/get_user_details',{role: role});
}

<table class="table table-striped">
  <thead>
    <tr>
      <th>YIC Id</th>
      <th>Name</th>
      <th>Email</th>
      <th>Status</th>
      <th>Controls</th>
    </tr>
  </thead>
  <tbody>
    <tr *ngFor="let one of values ,let i = index">
      <td>{{one[i]._id}}</td>
      <td>{{one[i].name}}</td>
      <td>{{one[i].email}}</td>
      <td>{{one[i].acc}}</td>

    </tr>
  </tbody>
</table>

My json data

[ { _id: '1',
name: 'ranjith',
email: '[email protected]',
acc: 'y',
profile_id: 'CVRsNE73.jpg' },
{ _id: '2',
name: 'Vigne',
email: '[email protected]',
acc: 'y',
profile_id: 'Jf0qcrVL.jpg' } ]

My code

Pramod Patil

You can directly access object variable without index

<tr *ngFor="let one of values">
  <td>{{one._id}}</td>
  <td>{{one.name}}</td>
  <td>{{one.email}}</td>
  <td>{{one.acc}}</td>

</tr>

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

I got error when I tried to get data from server

From Dev

Some errors when I tried to get JSON data from a server

From Dev

Bootstrap paginated table sending only 10 row's data to server

From Dev

How can I get row's index from a table in SQL Server?

From Dev

SQL Server: How can I get data from junction table that only has IDs?

From Dev

In rails, how to select one specific column's data from a table? (there is only 1 row so I want only a specific result but not an array)

From Dev

Displaying only 1 row for duplicated data in tableau table

From Dev

Add Dynamic Row Table Not Displaying The Right Row

From Dev

Get data from server only when there is new rows in MySQL table

From Dev

Angular is not displaying data in table row. ng-repeat is not working

From Dev

get a row from dynamic table (jquery)

From Dev

get a row from dynamic table (jquery)

From Dev

How to get only last iteration value while fetching data from the database,I've tried Getting values as JSON format

From Dev

How to add drop down list in every row of dynamic table which fetch data from server?

From Dev

Angular2 How can I use ngIf correctly to show some text only when there's no data from server?

From Dev

How to complete the code to get the output's first row only from a wikipedia page?

From Dev

angular - get data from server

From Dev

AJAX hover tooltip displays returned data only for first row in table

From Dev

PHP only displaying first word of string in table

From Dev

I am getting only first row of my table

From Dev

How to get first child table row from a table in BeautifulSoup ( Python )

From Dev

Displaying first row data in Report Header

From Dev

Only the first row row is required field - Dynamic table Knockout.js

From Dev

Dynamic table first row need to sow first

From Dev

SELECT * FROM table | Only getting the first row out of all

From Dev

Javascript pick values only from first row in the table

From Dev

Angularjs - Displaying data using $http get from remote server

From Dev

jQuery - Get data from table row and post it

From Dev

Get data from table row to Javascript

Related Related

  1. 1

    I got error when I tried to get data from server

  2. 2

    Some errors when I tried to get JSON data from a server

  3. 3

    Bootstrap paginated table sending only 10 row's data to server

  4. 4

    How can I get row's index from a table in SQL Server?

  5. 5

    SQL Server: How can I get data from junction table that only has IDs?

  6. 6

    In rails, how to select one specific column's data from a table? (there is only 1 row so I want only a specific result but not an array)

  7. 7

    Displaying only 1 row for duplicated data in tableau table

  8. 8

    Add Dynamic Row Table Not Displaying The Right Row

  9. 9

    Get data from server only when there is new rows in MySQL table

  10. 10

    Angular is not displaying data in table row. ng-repeat is not working

  11. 11

    get a row from dynamic table (jquery)

  12. 12

    get a row from dynamic table (jquery)

  13. 13

    How to get only last iteration value while fetching data from the database,I've tried Getting values as JSON format

  14. 14

    How to add drop down list in every row of dynamic table which fetch data from server?

  15. 15

    Angular2 How can I use ngIf correctly to show some text only when there's no data from server?

  16. 16

    How to complete the code to get the output's first row only from a wikipedia page?

  17. 17

    angular - get data from server

  18. 18

    AJAX hover tooltip displays returned data only for first row in table

  19. 19

    PHP only displaying first word of string in table

  20. 20

    I am getting only first row of my table

  21. 21

    How to get first child table row from a table in BeautifulSoup ( Python )

  22. 22

    Displaying first row data in Report Header

  23. 23

    Only the first row row is required field - Dynamic table Knockout.js

  24. 24

    Dynamic table first row need to sow first

  25. 25

    SELECT * FROM table | Only getting the first row out of all

  26. 26

    Javascript pick values only from first row in the table

  27. 27

    Angularjs - Displaying data using $http get from remote server

  28. 28

    jQuery - Get data from table row and post it

  29. 29

    Get data from table row to Javascript

HotTag

Archive