diff --git a/components/badge/badge-sup.component.ts b/components/badge/badge-sup.component.ts index cd377961a8..311fe3c521 100644 --- a/components/badge/badge-sup.component.ts +++ b/components/badge/badge-sup.component.ts @@ -3,7 +3,6 @@ * found in the LICENSE file at https://github.com/NG-ZORRO/ng-zorro-antd/blob/master/LICENSE */ -import { NgFor, NgIf } from '@angular/common'; import { ChangeDetectionStrategy, Component, @@ -27,27 +26,27 @@ import { NzSafeAny, NzSizeDSType } from 'ng-zorro-antd/core/types'; changeDetection: ChangeDetectionStrategy.OnPush, animations: [zoomBadgeMotion], standalone: true, - imports: [NgFor, NgIf, NzNoAnimationDirective], + imports: [NzNoAnimationDirective], template: ` - - - -

- {{ p }} -

-
-
-
- {{ nzOverflowCount }}+ + @if (count <= nzOverflowCount) { + @for (n of maxNumberArray; track n; let i = $index) { + + @if (!nzDot && countArray[i] !== undefined) { + @for (p of countSingleArray; track p) { +

+ {{ p }} +

+ } + } +
+ } + } @else { + {{ nzOverflowCount }}+ + } `, host: { class: 'ant-scroll-number', diff --git a/components/badge/badge.component.ts b/components/badge/badge.component.ts index afa5327aa1..debf3d29dc 100644 --- a/components/badge/badge.component.ts +++ b/components/badge/badge.component.ts @@ -4,7 +4,7 @@ */ import { Direction, Directionality } from '@angular/cdk/bidi'; -import { NgIf, NgStyle } from '@angular/common'; +import { NgStyle } from '@angular/common'; import { ChangeDetectionStrategy, ChangeDetectorRef, @@ -45,9 +45,9 @@ const NZ_CONFIG_MODULE_NAME: NzConfigKey = 'badge'; changeDetection: ChangeDetectionStrategy.OnPush, animations: [zoomBadgeMotion], standalone: true, - imports: [NgIf, NgStyle, NzBadgeSupComponent, NzOutletModule], + imports: [NgStyle, NzBadgeSupComponent, NzOutletModule], template: ` - + @if (nzStatus || nzColor) { {{ nzText }} - - + } + - + @if (showSup) { + + } `, host: { diff --git a/components/badge/badge.spec.ts b/components/badge/badge.spec.ts index d885d2f258..0fe5e74d16 100644 --- a/components/badge/badge.spec.ts +++ b/components/badge/badge.spec.ts @@ -204,7 +204,9 @@ describe('badge', () => { [nzStandalone]="!inner" [nzSize]="size" > - + @if (inner) { + + } ` }) diff --git a/components/badge/demo/colorful.ts b/components/badge/demo/colorful.ts index edb555a8cc..5000dd72f2 100644 --- a/components/badge/demo/colorful.ts +++ b/components/badge/demo/colorful.ts @@ -5,9 +5,11 @@ import { Component } from '@angular/core'; template: `

Presets:

-
- -
+ @for (color of colors; track color) { +
+ +
+ }

Custom: