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

194
Vistas
Keep Angular Dropdown Menu Open After Reload

I am operating an HTML/Typescript view that connects to a SQL Database. Any time the SQL is altered, the entire webpage reloads. There are several dropdown menus that clients would like to remain open after these reloads, to avoid time spent reopening, only closing once the button from which the dropdown originates is clicked, or a location outside the menu is clicked. Is there a way to ensure an open dropdown menu remains open after a reload?

Here is an example of one such dropdown.

<mat-form-field>
            <mat-label>Month</mat-label>
            <mat-select formControlName="month" (selectionChange)="isStandardOrCurrentCost()">
                <mat-option *ngFor="let month of getAvailableMonths()" [value]="month">{{month}}</mat-option>
            </mat-select>
            <control-messages [control]="form.get('month')"></control-messages>
</mat-form-field>
about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

Maybe an option you can consider is saving the state of opened dropdowns in the local storage. Whenever the page reload, life cycle methods will be called. Using something like ngAfterViewInit or ngAfterContentInit, you can get the state to see which dropdowns are activated. Then simulate a click on your select element. Use @ViewChild to get the html element and .nativeElement.click() to simulate the click. This is less than optimal and in the best world, you would only reload the component which consumes to SQL data, not the entire page.

about 4 years ago · Juan Pablo Isaza Denunciar
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