@@ -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' ,
@@ -57,7 +52,7 @@ export const MAT_TAB_GROUP = new InjectionToken<MatTabGroup>('MAT_TAB_GROUP');
5752 '[attr.id]' : 'null' ,
5853 } ,
5954} )
60- export class MatTab implements OnInit , OnChanges , OnDestroy {
55+ export class MatTab implements MatTabBase , OnInit , OnChanges , OnDestroy {
6156 private _viewContainerRef = inject ( ViewContainerRef ) ;
6257 _closestTabGroup = inject ( MAT_TAB_GROUP , { optional : true } ) ;
6358
@@ -79,11 +74,10 @@ export class MatTab implements OnInit, OnChanges, OnDestroy {
7974 * Template provided in the tab content that will be used if present, used to enable lazy-loading
8075 */
8176 @ContentChild ( MatTabContent , { read : TemplateRef , static : true } )
82- // The value will be set in `ngAfterViewInit`.
8377 private _explicitContent ?: TemplateRef < unknown > ;
8478
8579 /** Template inside the MatTab view that contains an `<ng-content>`. */
86- @ViewChild ( TemplateRef , { static : true } ) _implicitContent : TemplateRef < unknown > ;
80+ @ViewChild ( TemplateRef , { static : true } ) _implicitContent ? : TemplateRef < unknown > ;
8781
8882 /** Plain text label for the tab, used when there is no template label. */
8983 @Input ( 'label' ) textLabel : string = '' ;
@@ -155,7 +149,7 @@ export class MatTab implements OnInit, OnChanges, OnDestroy {
155149
156150 ngOnInit ( ) : void {
157151 this . _contentPortal = new TemplatePortal (
158- this . _explicitContent || this . _implicitContent ,
152+ this . _explicitContent || this . _implicitContent ! ,
159153 this . _viewContainerRef ,
160154 ) ;
161155 }
0 commit comments