@@ -24,18 +24,13 @@ import {
2424 inject ,
2525} from '@angular/core' ;
2626import { MatTabContent } from './tab-content' ;
27- import { MAT_TAB , MatTabLabel } from './tab-label' ;
27+ import { MatTabLabel } from './tab-label' ;
2828import { TemplatePortal } from '@angular/cdk/portal' ;
2929import { Subject } from 'rxjs' ;
3030import { _CdkPrivateStyleLoader } from '@angular/cdk/private' ;
3131import { _StructuralStylesLoader } from '../core' ;
32- import { type MatTabGroup } from './tab-group' ;
33-
34- /**
35- * Used to provide a tab group to a tab without causing a circular dependency.
36- * @docs -private
37- */
38- export const MAT_TAB_GROUP = new InjectionToken < MatTabGroup > ( 'MAT_TAB_GROUP' ) ;
32+ import { MAT_TAB , MatTabBase } from './tab-token' ;
33+ import { MAT_TAB_GROUP } from './tab-group-token' ;
3934
4035@Component ( {
4136 selector : 'mat-tab' ,
@@ -54,7 +49,7 @@ export const MAT_TAB_GROUP = new InjectionToken<MatTabGroup>('MAT_TAB_GROUP');
5449 'hidden' : '' ,
5550 } ,
5651} )
57- export class MatTab implements OnInit , OnChanges , OnDestroy {
52+ export class MatTab implements MatTabBase , OnInit , OnChanges , OnDestroy {
5853 private _viewContainerRef = inject ( ViewContainerRef ) ;
5954 _closestTabGroup = inject ( MAT_TAB_GROUP , { optional : true } ) ;
6055
@@ -76,11 +71,10 @@ export class MatTab implements OnInit, OnChanges, OnDestroy {
7671 * Template provided in the tab content that will be used if present, used to enable lazy-loading
7772 */
7873 @ContentChild ( MatTabContent , { read : TemplateRef , static : true } )
79- // The value will be set in `ngAfterViewInit`.
8074 private _explicitContent ?: TemplateRef < unknown > ;
8175
8276 /** Template inside the MatTab view that contains an `<ng-content>`. */
83- @ViewChild ( TemplateRef , { static : true } ) _implicitContent : TemplateRef < unknown > ;
77+ @ViewChild ( TemplateRef , { static : true } ) _implicitContent ? : TemplateRef < unknown > ;
8478
8579 /** Plain text label for the tab, used when there is no template label. */
8680 @Input ( 'label' ) textLabel : string = '' ;
@@ -146,7 +140,7 @@ export class MatTab implements OnInit, OnChanges, OnDestroy {
146140
147141 ngOnInit ( ) : void {
148142 this . _contentPortal = new TemplatePortal (
149- this . _explicitContent || this . _implicitContent ,
143+ this . _explicitContent || this . _implicitContent ! ,
150144 this . _viewContainerRef ,
151145 ) ;
152146 }
0 commit comments