Skip to content

Commit

Permalink
Merge pull request #24 from rengert/disable-when-loading
Browse files Browse the repository at this point in the history
feat: disable the button while loading
  • Loading branch information
dkreider authored Feb 1, 2024
2 parents 3efbbcc + f590246 commit 5e3cde0
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Directive, HostBinding, Input } from '@angular/core';
import { Directive, ElementRef, HostBinding, Input } from '@angular/core';

@Directive({
selector: '[mtBasicSpinner]',
Expand All @@ -9,6 +9,8 @@ export class MatBasicSpinnerDirective {
@Input() set mtBasicSpinner(loading: boolean) {
this.loading = loading
if (this.hideText) this.textHidden = loading

this.elem.nativeElement.disabled = loading;
}

@HostBinding('class.mat-spinner')
Expand All @@ -22,4 +24,6 @@ export class MatBasicSpinnerDirective {
return this.mtBasicSpinner;
}

constructor(private readonly elem: ElementRef<HTMLButtonElement>) {
}
}

0 comments on commit 5e3cde0

Please sign in to comment.