@@ -51,6 +51,7 @@ import {
5151} from './interfaces' ;
5252import { NzTabBodyComponent } from './tab-body.component' ;
5353import { NzTabCloseButtonComponent } from './tab-close-button.component' ;
54+ import { NzTabLinkDirective } from './tab-link.directive' ;
5455import { NzTabNavBarComponent } from './tab-nav-bar.component' ;
5556import { NzTabNavItemDirective } from './tab-nav-item.directive' ;
5657import { NZ_TAB_SET , NzTabComponent } from './tab.component' ;
@@ -251,6 +252,8 @@ export class NzTabSetComponent implements OnInit, AfterContentChecked, OnDestroy
251252 // We filter out only the tabs that belong to this tab set in `tabs`.
252253 @ContentChildren ( NzTabComponent , { descendants : true } )
253254 allTabs : QueryList < NzTabComponent > = new QueryList < NzTabComponent > ( ) ;
255+ @ContentChildren ( NzTabLinkDirective , { descendants : true } )
256+ tabLinks : QueryList < NzTabLinkDirective > = new QueryList < NzTabLinkDirective > ( ) ;
254257 @ViewChild ( NzTabNavBarComponent , { static : false } ) tabNavBarRef ! : NzTabNavBarComponent ;
255258
256259 // All the direct tabs for this tab set
@@ -475,13 +478,14 @@ export class NzTabSetComponent implements OnInit, AfterContentChecked, OnDestroy
475478 if ( ! this . router ) {
476479 throw new Error ( `${ PREFIX } you should import 'RouterModule' if you want to use 'nzLinkRouter'!` ) ;
477480 }
478- this . router . events
479- . pipe (
480- takeUntil ( this . destroy$ ) ,
481+ merge (
482+ this . router . events . pipe (
481483 filter ( e => e instanceof NavigationEnd ) ,
482- startWith ( true ) ,
483484 delay ( 0 )
484- )
485+ ) ,
486+ this . tabLinks . changes
487+ )
488+ . pipe ( takeUntil ( this . destroy$ ) , startWith ( true ) )
485489 . subscribe ( ( ) => {
486490 this . updateRouterActive ( ) ;
487491 this . cdr . markForCheck ( ) ;
@@ -495,7 +499,7 @@ export class NzTabSetComponent implements OnInit, AfterContentChecked, OnDestroy
495499 if ( index !== this . selectedIndex ) {
496500 this . setSelectedIndex ( index ) ;
497501 }
498- this . nzHideAll = index === - 1 ;
502+ Promise . resolve ( ) . then ( ( ) => ( this . nzHideAll = index === - 1 ) ) ;
499503 }
500504 }
501505
0 commit comments