Ngx-bootstrap: How to pass route in tabs?

Created on 16 Jun 2017  路  8Comments  路  Source: valor-software/ngx-bootstrap

Hi, Code is:-

<tabset>
<tab heading = "tab1" [routerLink] = "['/profile']">
</tab>
<tab heading = "tab2" [routerLink] = "['/test']">
</tab>
<tab heading = "tab3" [routerLink] = "['/customer']">
</tab>
</tabset>

Is it possible to routerLink in tabs without using a select function?

comp(tabs)

Most helpful comment

Why was this closed? This seems extremely useful.

All 8 comments

There is currently nothing that will handle the routerLink value. You can see the template at:

https://github.com/valor-software/ngx-bootstrap/blob/development/src/tabs/tabset.component.ts

hi there same issue here and when using the stack overflow response only clicking right on the link works. if you click below the link the tab swiches but the route does not.

@JanEggers you need to adjust for .nav-item in order to make it take 100% width and height of parent <li>

thx

Why was this closed? This seems extremely useful.

Any news or workarounds for this ? :)

Possible solution for this one:

 <tabset>
      <tab
        *ngFor="let item of items"
        (selectTab)="changeRoute(item)"
        [active]="item.id === activeTabId"
     ...
     </tab>
</tabset>

  public ngOnInit():void{
      ...
      const queryParams = (this.activatedRoute.queryParams as any).value;
      this.activeTabId = queryParams.tab;
     ...
  } 

  public changeRoute(item) {
    this.router.navigate(['.'],
      {
        queryParams: {tab: item.id},
        relativeTo: this.activatedRoute
      }
    );
Was this page helpful?
0 / 5 - 0 ratings

Related issues

ghiscoding picture ghiscoding  路  3Comments

RolfVeinoeSorensen picture RolfVeinoeSorensen  路  3Comments

hugonne picture hugonne  路  3Comments

pgeyman picture pgeyman  路  3Comments

juanitavollmering picture juanitavollmering  路  3Comments