Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

438
Visualizações
How to group Items in Angular Material List with Subheaders

I have an array of Objects that I would like to display in a Mat-Selection-List. These Objects have two properties, one which I want to group by and use as subheaders (foo) and one I would like to list/display (bar). The list should display all the objects all the time (so no filtering), the catch is that only the bar property is displayed and the objects are grouped by their foo-Property, which is used as a subheader.

The list should be built dynamically and eventually look similar to the following:

<mat-list>
  <ng-container *ngFor="each different Foo of Object-Array"
    <div mat-subheader> foo </div>
    <mat-list-item *ngFor="every object with this foo">    
      <div> bar </div>
    </mat-list-item>
  </ng-container>
</mat-list>

The *ngFors in the above code don't work and are intended to show what I'm trying to do. What is the "Angular-Way" of achieving such a list from an Array of Objects? Are Pipes the way to go and if so what should they look like?

about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda