Skip to content

Commit 4c16d2c

Browse files
committed
fix(material/tabs): remove dependency on NgClass (#28875)
We can set classes directly through `[class]` instead of having to import `NgClass`. (cherry picked from commit b3298f1)
1 parent eefb090 commit 4c16d2c

File tree

3 files changed

+4
-12
lines changed

3 files changed

+4
-12
lines changed

src/material/tabs/tab-group.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
[attr.aria-label]="tab.ariaLabel || null"
2121
[attr.aria-labelledby]="(!tab.ariaLabel && tab.ariaLabelledby) ? tab.ariaLabelledby : null"
2222
[class.mdc-tab--active]="selectedIndex === i"
23-
[ngClass]="tab.labelClass"
23+
[class]="tab.labelClass"
2424
[disabled]="tab.disabled"
2525
[fitInkBarToContent]="fitInkBarToContent"
2626
(click)="_handleClick(tab, tabHeader, i)"
@@ -72,7 +72,7 @@
7272
[attr.aria-labelledby]="_getTabLabelId(i)"
7373
[attr.aria-hidden]="selectedIndex !== i"
7474
[class.mat-mdc-tab-body-active]="selectedIndex === i"
75-
[ngClass]="tab.bodyClass"
75+
[class]="tab.bodyClass"
7676
[content]="tab.content!"
7777
[position]="tab.position!"
7878
[origin]="tab.origin"

src/material/tabs/tab-group.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ import {startWith} from 'rxjs/operators';
3737
import {CdkMonitorFocus, FocusOrigin} from '@angular/cdk/a11y';
3838
import {MatTabBody} from './tab-body';
3939
import {CdkPortalOutlet} from '@angular/cdk/portal';
40-
import {NgClass} from '@angular/common';
4140
import {MatTabLabelWrapper} from './tab-label-wrapper';
4241
import {Platform} from '@angular/cdk/platform';
4342

@@ -89,7 +88,6 @@ const ENABLE_BACKGROUND_INPUT = true;
8988
MatTabHeader,
9089
MatTabLabelWrapper,
9190
CdkMonitorFocus,
92-
NgClass,
9391
MatRipple,
9492
CdkPortalOutlet,
9593
MatTabBody,

src/material/tabs/tab.ts

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -90,16 +90,10 @@ export class MatTab implements OnInit, OnChanges, OnDestroy {
9090
*/
9191
@Input('aria-labelledby') ariaLabelledby: string;
9292

93-
/**
94-
* Classes to be passed to the tab label inside the mat-tab-header container.
95-
* Supports string and string array values, same as `ngClass`.
96-
*/
93+
/** Classes to be passed to the tab label inside the mat-tab-header container. */
9794
@Input() labelClass: string | string[];
9895

99-
/**
100-
* Classes to be passed to the tab mat-tab-body container.
101-
* Supports string and string array values, same as `ngClass`.
102-
*/
96+
/** Classes to be passed to the tab mat-tab-body container. */
10397
@Input() bodyClass: string | string[];
10498

10599
/** Portal that will be the hosted content of the tab */

0 commit comments

Comments
 (0)