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

0.0.11 • Public • Published

Ngx Long Click

Angular directive for detecting long clicks of an element in Angular 2 and up.

It is as simple as:

<div (longClick)="onLongClick($event)></div>

Demo

Demo

or

npm run start to run a local demo

Using the library

Import the library in any Angular application by running:

$ npm install ngx-long-click --save

and then from your Angular AppModule:

import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { AppComponent } from './app.component';

// Import the library module
import {NgxLongClickModule} from 'ngx-long-click';

@NgModule({
  declarations: [
    AppComponent
  ],
  imports: [
    BrowserModule,

    // Specify NgxLongClickModule library as an import
    NgxLongClickModule
  ],
  providers: [],
  bootstrap: [ AppComponent ]
})
export class AppModule { }

Once your library is imported, you can use its longClick directive in your Angular application:

<div (longClick)="onLongClick($event)"></div>

clickDelayMs specifies the time in milliseconds the element need to be pressed before the event is fired

<div (longClick)="onLongClick($event)" clickDelayMs="1000">Press for 1 sec</div>

License

MIT © Daniel Lofgren

Package Sidebar

Install

npm i ngx-long-click

Weekly Downloads

5

Version

0.0.11

License

MIT

Unpacked Size

26.9 kB

Total Files

17

Last publish

Collaborators

  • tylder