Unlimited level list for Menu


#1

I want to create a menu in sidebar. In which we will have unlimited level of subcategories. Please guide me if anyone know how can i do this in ionic 3.

This is my code and i want to change it to unlimited level subcategories;

    <ion-list>
      <ion-item menuClose *ngFor="let p of categories; let i = index" (click)="openPage(p)">
        {{p.name}}
        <ion-icon *ngIf="p.subcategories.length" name="ios-arrow-forward" item-end></ion-icon>
        <div *ngIf="p.subcategories.length">
          <ion-item *ngFor="let s of p.subcategories">
            {{s.name}}
            <ion-icon *ngIf="p.subcategories.length" name="ios-arrow-forward" item-end></ion-icon>
          </ion-item>
        </div>
      </ion-item>
    </ion-list>```