Skip to content

Commit aa14cf1

Browse files
committed
workaround for gcp issue
1 parent 2f725c9 commit aa14cf1

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

src/material/tabs/tab.ts

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,18 @@ const _MatTabMixinBase: CanDisableCtor & typeof MatTabBase =
4545
})
4646
export class MatTab extends _MatTabMixinBase implements OnInit, CanDisable, OnChanges, OnDestroy {
4747
/** Content for the tab label given by `<ng-template mat-tab-label>`. */
48-
@ContentChild(MatTabLabel, {static: false}) templateLabel: MatTabLabel;
48+
@ContentChild(MatTabLabel, {static: false})
49+
get templateLabel(): MatTabLabel {return this._templateLabel;}
50+
set templateLabel(value: MatTabLabel) {
51+
// Only update the templateLabel via query if there is actually
52+
// a MatTabLabel found. This works around an issue where a user may have
53+
// manually set `templateLabel` during creation mode, which would then get clobbered
54+
// by `undefined` when this query resolves.
55+
if (value) {
56+
this._templateLabel = value;
57+
}
58+
}
59+
private _templateLabel: MatTabLabel;
4960

5061
/**
5162
* Template provided in the tab content that will be used if present, used to enable lazy-loading

0 commit comments

Comments
 (0)