Skip to content

Commit

Permalink
refactor(module:avatar): implement new control flow (#8288)
Browse files Browse the repository at this point in the history
  • Loading branch information
Nicoss54 authored Dec 14, 2023
1 parent c17bf16 commit d287c47
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions components/avatar/avatar.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
*/

import { Platform, PlatformModule } from '@angular/cdk/platform';
import { NgIf } from '@angular/common';
import {
ChangeDetectionStrategy,
ChangeDetectorRef,
Expand All @@ -30,11 +29,17 @@ const NZ_CONFIG_MODULE_NAME: NzConfigKey = 'avatar';
selector: 'nz-avatar',
exportAs: 'nzAvatar',
standalone: true,
imports: [NgIf, NzIconModule, PlatformModule],
imports: [NzIconModule, PlatformModule],
template: `
<span nz-icon *ngIf="nzIcon && hasIcon" [nzType]="nzIcon"></span>
<img *ngIf="nzSrc && hasSrc" [src]="nzSrc" [attr.srcset]="nzSrcSet" [attr.alt]="nzAlt" (error)="imgError($event)" />
<span class="ant-avatar-string" #textEl *ngIf="nzText && hasText">{{ nzText }}</span>
@if (nzIcon && hasIcon) {
<span nz-icon [nzType]="nzIcon"></span>
}
@if (nzSrc && hasSrc) {
<img [src]="nzSrc" [attr.srcset]="nzSrcSet" [attr.alt]="nzAlt" (error)="imgError($event)" />
}
@if (nzText && hasText) {
<span class="ant-avatar-string" #textEl>{{ nzText }}</span>
}
`,
host: {
class: 'ant-avatar',
Expand Down

0 comments on commit d287c47

Please sign in to comment.