ngx-async-click
TypeScript icon, indicating that this package has built-in type declarations

2.1.1 • Public • Published

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));
  }

/ngx-async-click/

    Package Sidebar

    Install

    npm i ngx-async-click

    Weekly Downloads

    1

    Version

    2.1.1

    License

    MIT

    Unpacked Size

    30.8 kB

    Total Files

    13

    Last publish

    Collaborators

    • utamuratov