Search code examples
angularsqliteionic4ionic-storage

How do I start the index array after 1 in an ionic 4 App sqlite db


I am looping thought the the sqlite db with ionic storage using this code

ts

listKeys() {
  this.storage.keys().then((k) => {
    console.table(k);
    this.loop = k;
    console.log("key value", this.loop);
  });
}

Here is what I get

list of keys

I use this html to view my list

  <ion-item-sliding *ngFor="let list of loop; index as i ">
    <ion-item>
        {{loop[i]}}
    </ion-item>
    <ion-item-options side="end">
      <ion-item-option (click)="deleteKeyValue( loop[i] )" color="danger">
        <ion-icon slot="icon-only" name="trash"></ion-icon>
      </ion-item-option>
    </ion-item-options>
  </ion-item-sliding>

I wish to start the loop after Index 1. I have tried "index as i > 1 " and loop[ i > 1 ]. of course neither work. Any help would be greatly appreciated.


Solution

  • Use the SlicePipe https://angular.io/api/common/SlicePipe

    <ion-item-sliding *ngFor="let list of loop | slice:2; index as i ">