@@ -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' ,
@@ -57,7 +52,7 @@ export const MAT_TAB_GROUP = new InjectionToken<MatTabGroup>('MAT_TAB_GROUP');
57
52
'[attr.id]' : 'null' ,
58
53
} ,
59
54
} )
60
- export class MatTab implements OnInit , OnChanges , OnDestroy {
55
+ export class MatTab implements MatTabBase , OnInit , OnChanges , OnDestroy {
61
56
private _viewContainerRef = inject ( ViewContainerRef ) ;
62
57
_closestTabGroup = inject ( MAT_TAB_GROUP , { optional : true } ) ;
63
58
@@ -79,11 +74,10 @@ export class MatTab implements OnInit, OnChanges, OnDestroy {
79
74
* Template provided in the tab content that will be used if present, used to enable lazy-loading
80
75
*/
81
76
@ContentChild ( MatTabContent , { read : TemplateRef , static : true } )
82
- // The value will be set in `ngAfterViewInit`.
83
77
private _explicitContent ?: TemplateRef < unknown > ;
84
78
85
79
/** 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 > ;
87
81
88
82
/** Plain text label for the tab, used when there is no template label. */
89
83
@Input ( 'label' ) textLabel : string = '' ;
@@ -155,7 +149,7 @@ export class MatTab implements OnInit, OnChanges, OnDestroy {
155
149
156
150
ngOnInit ( ) : void {
157
151
this . _contentPortal = new TemplatePortal (
158
- this . _explicitContent || this . _implicitContent ,
152
+ this . _explicitContent || this . _implicitContent ! ,
159
153
this . _viewContainerRef ,
160
154
) ;
161
155
}
0 commit comments