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,