From c17bf169280ee9f25a286ed2e3acc7e81cd59abf Mon Sep 17 00:00:00 2001 From: Nicolas Frizzarin Date: Thu, 14 Dec 2023 02:14:53 +0100 Subject: [PATCH] refactor(module:alert): implement new control flow (#8289) --- components/alert/alert.component.ts | 113 +++++++++++++++------------- 1 file changed, 60 insertions(+), 53 deletions(-) diff --git a/components/alert/alert.component.ts b/components/alert/alert.component.ts index e4d54f9453..0c07170b34 100644 --- a/components/alert/alert.component.ts +++ b/components/alert/alert.component.ts @@ -4,7 +4,6 @@ */ import { Direction, Directionality } from '@angular/cdk/bidi'; -import { NgIf } from '@angular/common'; import { ChangeDetectionStrategy, ChangeDetectorRef, @@ -37,60 +36,68 @@ const NZ_CONFIG_MODULE_NAME: NzConfigKey = 'alert'; exportAs: 'nzAlert', animations: [slideAlertMotion], standalone: true, - imports: [NgIf, NzIconModule, NzOutletModule], + imports: [NzIconModule, NzOutletModule], template: ` -
-
- - - - - - -
-
- - {{ nzMessage }} - - - {{ nzDescription }} - -
-
- {{ nzAction }} -
- -
+ @if (nzShowIcon) { +
+ @if (nzIcon) { + + } @else { + + } +
+ } + + @if (nzMessage || nzDescription) { +
+ @if (nzMessage) { + + {{ nzMessage }} + + } + @if (nzDescription) { + + {{ nzDescription }} + + } +
+ } + + @if (nzAction) { +
+ {{ nzAction }} +
+ } + + @if (nzCloseable || nzCloseText) { + + } + + } `, changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None,