Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

112
Vistas
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 la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda