@webacad/one-click-button
v0.0.3
Published
Angular directive for disabling buttons after first click
Downloads
2
Readme
WebACAD/OneClickButton
Angular directive for disabling buttons after first click
Installation
$ npm install --save @webacad/one-click-button
or with yarn
$ yarn add @webacad/one-click-button
Register module
import {NgModule} from '@angular/core';
import {WaOneClickButtonDirective} from '@webacad/one-click-button';
@NgModule({
imports: [
WaOneClickButtonDirective,
],
})
export class AppModule {}
Usage
<button waOneClickButton (click)="doSomething()">Click and disable</button>
Now when you click on that button, your doSomething()
method will be normally called, but after that the button will
receive the disabled
state.
Re-enable button
<button #btn="oneClickBtn" waOneClickButton (click)="doSomething()">Click and disable</button>
<button (click)="btn.enable()">Re-enable</button>
Available methods
enable()
: Enable disabled buttondisable()
: Disable enabled button