Skip to content

Commit

Permalink
feat: disable the button while loading
Browse files Browse the repository at this point in the history
  • Loading branch information
rengert committed Feb 1, 2024
1 parent 3efbbcc commit f590246
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 f590246

Please sign in to comment.