-1

I have a mat-list and I am displaying category and name with data in it. Please note the stackblitz: https://stackblitz.com/edit/angular-material-list-krzxrz?file=app%2Fapp.component.ts

What I need is to arrange is so that the category Fruits comes as heading with the fruit names under it, and then the same with vegetables.

Jojofoulk
  • 1,969
  • 1
  • 6
  • 22
androidGenX
  • 1,020
  • 2
  • 16
  • 43

1 Answers1

1

If what you want to achieve is display each item of a category under a header with that category name, a possible approach is to group your array of object (simpleItems) by name and then use the keyvalue pipe to print the key followed by the elements.

Here's a Stackblitz example.

Hope this helps.

Jojofoulk
  • 1,969
  • 1
  • 6
  • 22