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

109
Visualizações
Angular Button list, overflow in to list instead of wrap

I have a list of buttons: enter image description here

when there is overflow, I want the buttons to be in a drop list like this:

enter image description here

And i need it to be dynamic (re arrange page size change)

I tryed this:

 ngAfterViewInit() {
    const width = this.container.nativeElement.offsetWidth;
    const fittingActions = [...this.container.nativeElement.children];
    let fittingActionsWidth = 0;

    for (const action of fittingActions) {
      fittingActionsWidth = fittingActionsWidth + action.clientWidth
      if (fittingActionsWidth < width) {
        this.actionCountToDisplay = this.actionCountToDisplay + 1
      }
    }
  }
<ng-container *ngFor="let action of actionButtons.slice(0, actionCountToDisplay || actionButtons.length)">
    <button
      (click)="action.onClick($event)"
      mat-flat-button color="primary">
      <span>{{action.label}}</span>
    </button>
  </ng-container>

but it dident work wel

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