Question Regarding local storage

After a long time, I visited this forum hope all developer is absolutely fine in this pandemic situation. I have faced some issues regarding local storage issues I have a filter list please can you tell me how can I save this filter in local storage my filter looks like this


<mat-chip color="accent" selected *ngFor="let filtrst of tempFilterStorage; let i=index">

  {{columnsName[filtrst.colId] | titlecase}} {{filtrst.searchCond}} {{filtrst.searchVal}}

  <div class="chip-close">

    <i class="icon-close-1" (click)="removeFilter(i)"></i>



const obj: any = {

  tableId: this.tableId,

  colId: this.fieldName,

  searchCond: oprtr,

  searchVal: this.fieldValue,




now i want to save this filter alone with a name

help me guys

I think you can use the standard js version for it.

So setting an item is:

localStorage.setItem(‘variable_name’, ‘variable_value’);

And to get it back do:

var variable_name= localStorage.getItem(‘variable_name’) || ‘false’;

Variables will be saved as a string, so if you’re saving json then you’ll need to convert it back when getting it