🌐 AI搜索 & 代理 主页
Skip to content

Commit c8adcfe

Browse files
committed
refactor: migration from NgClass to class bindings
1 parent f11bd87 commit c8adcfe

33 files changed

+70
-86
lines changed

projects/coreui-angular/src/lib/avatar/avatar.component.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,6 @@
1616
}
1717
</ng-content>
1818
@if (!!status()) {
19-
<span [ngClass]="statusClass()"></span>
19+
<span [class]="statusClass()"></span>
2020
}
2121

projects/coreui-angular/src/lib/avatar/avatar.component.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import { NgClass } from '@angular/common';
21
import { Component, computed, input, InputSignal } from '@angular/core';
32

43
import { Colors, Shapes, Sizes, TextColors } from '../coreui.types';
@@ -8,7 +7,6 @@ import { TextColorDirective } from '../utilities';
87
selector: 'c-avatar',
98
templateUrl: './avatar.component.html',
109
styleUrls: ['./avatar.component.scss'],
11-
imports: [NgClass],
1210
hostDirectives: [
1311
{
1412
directive: TextColorDirective,

projects/coreui-angular/src/lib/header/header/header.component.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
@if (!!container()) {
2-
<div [ngClass]="headerClasses()">
2+
<div [class]="headerClasses()">
33
<ng-content />
44
</div>
55
} @else {

projects/coreui-angular/src/lib/header/header/header.component.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import { Component, computed, input, InputSignal } from '@angular/core';
2-
import { NgClass } from '@angular/common';
32

43
import { Positions } from '../../coreui.types';
54

@@ -8,7 +7,6 @@ type Container = boolean | 'sm' | 'md' | 'lg' | 'xl' | 'xxl' | 'fluid';
87
@Component({
98
selector: 'c-header, [c-header]',
109
templateUrl: './header.component.html',
11-
imports: [NgClass],
1210
exportAs: 'cHeader',
1311
host: { '[attr.role]': 'role()', '[class]': 'hostClasses()' }
1412
})

projects/coreui-angular/src/lib/navbar/navbar.component.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<ng-container *ngTemplateOutlet="container() ? withContainerTemplate : noContainerTemplate" />
22

33
<ng-template #withContainerTemplate>
4-
<div [ngClass]="containerClass()">
4+
<div [class]="containerClass()">
55
<ng-content />
66
</div>
77
</ng-template>

projects/coreui-angular/src/lib/navbar/navbar.component.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import {
1212
OnDestroy,
1313
signal
1414
} from '@angular/core';
15-
import { NgClass, NgTemplateOutlet } from '@angular/common';
15+
import { NgTemplateOutlet } from '@angular/common';
1616
import { Subscription } from 'rxjs';
1717

1818
import { CollapseDirective } from '../collapse';
@@ -25,7 +25,7 @@ import { ThemeDirective } from '../shared';
2525
@Component({
2626
selector: 'c-navbar',
2727
templateUrl: './navbar.component.html',
28-
imports: [NgClass, NgTemplateOutlet],
28+
imports: [NgTemplateOutlet],
2929
hostDirectives: [{ directive: ThemeDirective, inputs: ['colorScheme'] }],
3030
host: { '[class]': 'hostClasses()', '[attr.role]': 'role()' }
3131
})
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
<ul [ngClass]="paginationClass()">
1+
<ul [class]="paginationClass()">
22
<ng-content />
33
</ul>

projects/coreui-angular/src/lib/pagination/pagination/pagination.component.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
11
import { Component, computed, input } from '@angular/core';
2-
import { NgClass } from '@angular/common';
32

43
@Component({
54
selector: 'c-pagination',
65
templateUrl: './pagination.component.html',
7-
imports: [NgClass],
86
host: {
97
'[attr.role]': 'role()'
108
}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
<ng-container>
2-
<div [ngClass]="{'popover-arrow': !!content()}" data-popper-arrow></div>
2+
<div [class.popover-arrow]="!!content()" data-popper-arrow></div>
33
<ng-container #popoverTemplate />
44
</ng-container>

projects/coreui-angular/src/lib/popover/popover/popover.component.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,11 @@ import {
1111
viewChild,
1212
ViewContainerRef
1313
} from '@angular/core';
14-
import { NgClass } from '@angular/common';
14+
1515

1616
@Component({
1717
selector: 'c-popover',
1818
templateUrl: './popover.component.html',
19-
imports: [NgClass],
2019
host: {
2120
class: 'popover fade bs-popover-auto',
2221
'[class]': 'hostClasses()',

0 commit comments

Comments
 (0)