@@ -24,18 +24,13 @@ import {
24
24
inject ,
25
25
} from '@angular/core' ;
26
26
import { MatTabContent } from './tab-content' ;
27
- import { MAT_TAB , MatTabLabel } from './tab-label' ;
27
+ import { MatTabLabel } from './tab-label' ;
28
28
import { TemplatePortal } from '@angular/cdk/portal' ;
29
29
import { Subject } from 'rxjs' ;
30
30
import { _CdkPrivateStyleLoader } from '@angular/cdk/private' ;
31
31
import { _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' ;
39
34
40
35
@Component ( {
41
36
selector : 'mat-tab' ,
@@ -54,7 +49,7 @@ export const MAT_TAB_GROUP = new InjectionToken<MatTabGroup>('MAT_TAB_GROUP');
54
49
'hidden' : '' ,
55
50
} ,
56
51
} )
57
- export class MatTab implements OnInit , OnChanges , OnDestroy {
52
+ export class MatTab implements MatTabBase , OnInit , OnChanges , OnDestroy {
58
53
private _viewContainerRef = inject ( ViewContainerRef ) ;
59
54
_closestTabGroup = inject ( MAT_TAB_GROUP , { optional : true } ) ;
60
55
@@ -76,11 +71,10 @@ export class MatTab implements OnInit, OnChanges, OnDestroy {
76
71
* Template provided in the tab content that will be used if present, used to enable lazy-loading
77
72
*/
78
73
@ContentChild ( MatTabContent , { read : TemplateRef , static : true } )
79
- // The value will be set in `ngAfterViewInit`.
80
74
private _explicitContent ?: TemplateRef < unknown > ;
81
75
82
76
/** 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 > ;
84
78
85
79
/** Plain text label for the tab, used when there is no template label. */
86
80
@Input ( 'label' ) textLabel : string = '' ;
@@ -146,7 +140,7 @@ export class MatTab implements OnInit, OnChanges, OnDestroy {
146
140
147
141
ngOnInit ( ) : void {
148
142
this . _contentPortal = new TemplatePortal (
149
- this . _explicitContent || this . _implicitContent ,
143
+ this . _explicitContent || this . _implicitContent ! ,
150
144
this . _viewContainerRef ,
151
145
) ;
152
146
}
0 commit comments