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

106
Views
Store last selected value in switching between list/tiles view using angular

I have a list / Tiles view for my project list. In which initially i am showing the default view to the user as Tiles view (Which is the default view when user comes into our dashboard). I mean i am giving the 2 views of the same data. But what i need is i need to give the user if he dont this tiles view and instead he needs list view then that view should be stored when he navigates from ona page to other or even if he log out from the system also what he last selected should be the view only. For that i have written this code. See below.

list.component.htmml

<mat-button-toggle-group #group="matButtonToggleGroup" [(value)]="View" appearance="legacy" class="tile-position">
                <mat-button-toggle value="Tiles" (click)="openTilesView();" appearance="legacy">
                    <i class="fa fa-th" aria-hidden="true"></i>
                    
                </mat-button-toggle>
                <mat-button-toggle value="List" (click)="openListView();" appearance="legacy">
                    <i class="fa fa-list" aria-hidden="true"></i> 
                </mat-button-toggle>

list.component.ts

    showListView: boolean = false;
      showTilesView: boolean = true;
      View = 'Tiles';
      hideAllGen: boolean = true;

getprojectDetails(data) {
    this.projects = data;
    this.dataSource = new MatTableDataSource(data);
    this.dataSource.sort = this.sort;
  }

  openListView() {
    this.keyword = '';
    this.hideAllGen = true;
    this.showListView = true;
    this.showTilesView = false;
    this.View = 'List';
}

openTilesView() {
  this.keyword = '';
    this.View = 'Tiles';
    this.showListView = false;
    this.showTilesView = true;
}
about 4 years ago · Juan Pablo Isaza
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!