List an array within the array with Angular 4 ngFor

Asked

Viewed 441 times

0

If anyone can help me. I have the following array

[{resourceGroup: "grupo1", idsporgroup: Array(4)}
{resourceGroup: "grupo2", idsporgroup: Array(2)}
{resourceGroup: "grupo3", idsporgroup: Array(3)}
{resourceGroup: "grupo4", idsporgroup: Array(5)}]

idsporgroup[
{id: "123456", total: 4.04166666}
{id: "123456", total: 6.0833333199999995}
{id: "123456", total: 0.25804800000000006}
{id: "123456", total: 96}]

I’m passing a *ngFor="Let a of consumptionResourceG" and {{a. idsporgroup}} and just show me up [Object] if I put {{a.idsporgroup.id}}I don’t see anything, I’ve converted into a string and it worked... more precisely put the ID and the Total in specific HTML places.

has to stay Group1

id: 0000 total: 000
id: 0000 total: 000
id: 0000 total: 000

Group2

id: 0000 total: 000

Group3

id: 0000 total: 000
id: 0000 total: 000

Trying an ngFor inside ngFor more without much success.

  • The second is: ngFor="let item of a.idsporgroup"

  • the bottom of the main ngfor:<tbody *ngFor="Let a of consumptionResG.idsporgroup"> <tr> <td>{a. id}}</td> <td>{a. total}}</td> </tr> </tbody>

  • 1

    Post your html @Fernando! Where do you do these for.

  • Check out this link here: https://stackoverflow.com/questions/29028840/angularjs-ng-repeat-array-in-array Maybe solution 2 can help you.

  • Opá Marconi actually commented wrong yesterday, had already worked, I passed the HTML as it had been. The bottom of the main ngFor passed ngFor as you had spoken and it worked out, now I understood the concept. Thanks

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.