Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

192
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!