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

107
Visualizações
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
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