2.1.1 • Published 9 months ago

ngx-async-click v2.1.1

Weekly downloads
-
License
MIT
Repository
github
Last release
9 months ago

Angular async click directive

DEMO

Installation

Use this following command to install:

npm i ngx-async-click

Usage

Version <1.1.0

import { AsyncClickModule} from 'ngx-async-click';

@NgModule({
  declarations: [AppComponent],
  imports: [AsyncClickModule],
  bootstrap: [AppComponent]
})
export class AppModule {}

Version >=1.1.0 (Implemented standalone directive)

import { AsyncClickDirective} from 'ngx-async-click';

@NgModule({
  declarations: [AppComponent],
  imports: [AsyncClickDirective],
  bootstrap: [AppComponent]
})
export class AppModule {}

Using

[ngxAsyncClick]="methodName.bind(this, [args])"

for example

In the HTML template

<button [ngxAsyncClick]="clickWithoutArguments.bind(this)">
  Click me (without arguments)
</button>
<button [ngxAsyncClick]="clickWithoutArguments.bind(this, 'test')">
  Click me (with arguments)
</button>

In the .ts file:

  clickWithoutArguments() {
    //
    return of(1).pipe(delay(1000));
  }

  clickWithArguments(args: any[]) {
    //
    return of(1).pipe(delay(1000));
  }
2.1.1

9 months ago

2.1.0

9 months ago

2.0.1

9 months ago

2.0.0

9 months ago

1.1.1

1 year ago

1.1.0

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago