Skip to content

Commit 5e3cde0

Browse files
authored
Merge pull request #24 from rengert/disable-when-loading
feat: disable the button while loading
2 parents 3efbbcc + f590246 commit 5e3cde0

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

projects/ngx-loading-buttons/src/lib/mat-basic-spinner.directive.ts

+5-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Directive, HostBinding, Input } from '@angular/core';
1+
import { Directive, ElementRef, HostBinding, Input } from '@angular/core';
22

33
@Directive({
44
selector: '[mtBasicSpinner]',
@@ -9,6 +9,8 @@ export class MatBasicSpinnerDirective {
99
@Input() set mtBasicSpinner(loading: boolean) {
1010
this.loading = loading
1111
if (this.hideText) this.textHidden = loading
12+
13+
this.elem.nativeElement.disabled = loading;
1214
}
1315

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

27+
constructor(private readonly elem: ElementRef<HTMLButtonElement>) {
28+
}
2529
}

0 commit comments

Comments
 (0)