Skip to content

Commit 0f7f94d

Browse files
authored
fix(module:tabs): nzLinkRouter not work for the first time (#9118)
1 parent 2500821 commit 0f7f94d

File tree

2 files changed

+5
-9
lines changed

2 files changed

+5
-9
lines changed

components/tabs/tab.component.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,9 @@ export const NZ_TAB_SET = new InjectionToken<NzSafeAny>('NZ_TAB_SET');
4343
<ng-template #tabLinkTemplate>
4444
<ng-content select="[nz-tab-link]"></ng-content>
4545
</ng-template>
46-
<ng-template #contentTemplate><ng-content></ng-content></ng-template>
46+
<ng-template #contentTemplate>
47+
<ng-content></ng-content>
48+
</ng-template>
4749
`
4850
})
4951
export class NzTabComponent implements OnChanges, OnDestroy {

components/tabs/tabset.component.ts

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -483,14 +483,8 @@ export class NzTabSetComponent implements OnInit, AfterContentChecked, OnDestroy
483483
if (!this.router) {
484484
throw new Error(`${PREFIX} you should import 'RouterModule' if you want to use 'nzLinkRouter'!`);
485485
}
486-
merge(
487-
this.router.events.pipe(
488-
filter(e => e instanceof NavigationEnd),
489-
delay(0)
490-
),
491-
this.tabLinks.changes
492-
)
493-
.pipe(takeUntil(this.destroy$), startWith(true))
486+
merge(this.router.events.pipe(filter(e => e instanceof NavigationEnd)), this.tabLinks.changes)
487+
.pipe(delay(0), takeUntil(this.destroy$))
494488
.subscribe(() => {
495489
this.updateRouterActive();
496490
this.cdr.markForCheck();

0 commit comments

Comments
 (0)