user image

Rakshit
Published in : 2022-03-06

Angular: Change columns to rows, and rows to columns while running a *ngFor loop.

Angular

I want to make my columns as rows and rows as columns in the table view. How can I do that?

My data is given below;

data = [{id: 1,name: 'Rakshit',age: 18salary: $15/hr},{id: 2,name: 'Ashish',age: 19salary: $18/hr},{id: 3,name: 'Pragnesh',age: 18salary: $20/hr}];

Using *ngFor I am able to make a table looks like below,

ID | Name | Age | Salary1 | Rakshit | 18 | $15/hr2 | Ashish | 19 | $18/hr3 | Pragnesh| 18 | $20/hr

I want to change columns to row, my expected output should be,

ID | 1 | 2 | 3Name | Rakshit | Ashish | PragneshAge | 18 | 19 | 18Salary | $15/hr | $18/hr | $20/hr

How do I loop it to get above results?

Ref: //blog.angular-university.io/angular-2-ngfor/

Comments

There is no comments yet

Leave a comment

Join us

Join our community and get the chance to solve your code issues & share your opinion with us

Sign up Now

Related posts

How to calculate distance between two Bluetooth devices?
Publish date: 2022-02-26 | Comments: 1

Tag: Angular

How to bind Weekends off to my kendo calendar in Angular?
Publish date: 2022-03-11 | Comments: 2

Tag: Angular

In Angular project, RxJS isStopped is deprecated! What is the alternative?
Publish date: 2022-02-28 | Comments: 1

Tag: Angular

Angular: HTML anchor tag with #idref issue
Publish date: 2022-03-01 | Comments: 2

Tag: Angular

How to reload Angular component without refreshing page?
Publish date: 2022-03-02 | Comments: 1

Tag: Angular

How to call event handler onload for Angular application?
Publish date: 2022-03-02 | Comments: 2

Tag: Angular

Adding country flags is really struggling thing?
Publish date: 2022-02-25 | Comments: 6

Tag: Angular