From 15620770ffc3dc94bc36bc816e82c8c7aa8957de Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=87etin?= <69278826+cetincakiroglu@users.noreply.github.com> Date: Wed, 15 May 2024 17:48:25 +0300 Subject: [PATCH] Fixes #15582 - Button | Remove wrapper span element from icon templates --- src/app/components/button/button.interface.ts | 15 +++++++++++++-- src/app/components/button/button.ts | 11 ++++------- 2 files changed, 17 insertions(+), 9 deletions(-) diff --git a/src/app/components/button/button.interface.ts b/src/app/components/button/button.interface.ts index 3d2d5dcda70..6002d5a0b4f 100644 --- a/src/app/components/button/button.interface.ts +++ b/src/app/components/button/button.interface.ts @@ -1,3 +1,4 @@ +import { NgClass } from '@angular/common'; import { TemplateRef } from '@angular/core'; /** @@ -12,9 +13,19 @@ export interface ButtonTemplates { /** * Custom template of icon. */ - icon(): TemplateRef; + icon(context: { + /** + * Icon class. + */ + class: NgClass; + }): TemplateRef; /** * Custom template of loadingicon. */ - loadingicon(): TemplateRef; + loadingicon(context: { + /** + * Icon class. + */ + class: NgClass; + }): TemplateRef; } diff --git a/src/app/components/button/button.ts b/src/app/components/button/button.ts index 9a2ec2cd700..c8d8e45256b 100755 --- a/src/app/components/button/button.ts +++ b/src/app/components/button/button.ts @@ -350,18 +350,14 @@ export class ButtonDirective implements AfterViewInit, OnDestroy { - + - - - + - - - + {{ label }} {{ badge }} @@ -525,6 +521,7 @@ export class Button implements AfterContentInit { iconClass() { return { + [`p-button-loading-icon pi-spin ${this.loadingIcon ?? ''}`]: this.loading, 'p-button-icon': true, 'p-button-icon-left': this.iconPos === 'left' && this.label, 'p-button-icon-right': this.iconPos === 'right' && this.label,