Skip to content

igxTabs and igxBottomNav should support router outlet #4297

Closed
@kdinev

Description

@kdinev

Is your feature request related to a problem? Please describe.

When using an IgxTabs component or IgxBottomNav component, I want to load the content in the tabs according to the route that the user has gone to. Right now I can only have my components inside the tabs and bottom nav content and they are all loaded with the top-level component.

E.g. with tabs:

<igx-tabs>
    <igx-tabs-group>
      <ng-template igxTab>
        <div class="horizontal-center">
          <igx-icon>people_outline</igx-icon>
          <div class="igx-tabs__item-label">Team Details</div>
        </div> 
      </ng-template>

      <app-team-details [team]="team" [userId]="authUser?.SteamUser?.steamID64">
      </app-team-details>
    </igx-tabs-group>

    <igx-tabs-group *ngIf="userIsMember">
      <ng-template igxTab>
        <div class="horizontal-center">
          <igx-icon>playlist_add_check</igx-icon>
          <div class="igx-tabs__item-label">Team Strats</div>
        </div> 
      </ng-template>

      <app-team-strategies [isAdmin]="userIsAdmin" [isEditor]="userIsEditor">
      </app-team-strategies>
    </igx-tabs-group>
</igx-tabs>

E.g. with bottom nav:

<igx-bottom-nav>
  <igx-tab-panel label="Tab 1">
    <app-component1></app-component1>
  </igx-tab-panel>
  <igx-tab-panel label="Tab 2">
    <app-component2></app-component2>
  </igx-tab-panel>
  <igx-tab-panel label="Tab 3">
    <app-component3></app-component3>
  </igx-tab-panel>
</igx-bottom-nav>

Describe the solution you'd like

I would like the configuration to be something similar to:

E.g. tabs:

<igx-tabs>
    <igx-tabs-group [routerLink]="['/teams', 'details']">
      <div class="horizontal-center">
        <igx-icon>people_outline</igx-icon>
        <div class="igx-tabs__item-label">Team Details</div>
      </div> 
    </igx-tabs-group>

    <igx-tabs-group *ngIf="userIsMember"  [routerLink]="['/teams', 'strats']">
      <div class="horizontal-center">
        <igx-icon>playlist_add_check</igx-icon>
        <div class="igx-tabs__item-label">Team Strats</div>
      </div> 
    </igx-tabs-group>
</igx-tabs>
<div class="content">
  <router-outlet></router-outlet>
</div>

E.g. bottom-nav:

<div class="content">
  <router-outlet></router-outlet>
</div>
<igx-bottom-nav>
  <igx-tab-panel  [routerLink]="['/tabs, 1]">
    <igx-icon>playlist_add_check</igx-icon>
    <div>Tab 1</div>
  </igx-tab-panel>
  <igx-tab-panel [routerLink]="['/tabs, 2]">
    <igx-icon>playlist_add_check</igx-icon>
    <div>Tab 2</div>
  </igx-tab-panel>
  <igx-tab-panel [routerLink]="['/tabs, 3]">
    <igx-icon>playlist_add_check</igx-icon>
    <div>Tab 3</div>
  </igx-tab-panel>
</igx-bottom-nav>

Describe alternatives you've considered

The only way to do this currently is to have all my routes with arguments going to one component, which handling of the selected index based on the routing param. This would still load all the components together with the top-level component.

Additional context

The current implementation is not very developer friendly.

Metadata

Metadata

Labels

🧰 feature-request✅ status: resolvedApplies to issues that have pending PRs resolving them, or PRs that have already merged.bottom-navBottom navigation componenttabs

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions