0.2.2 • Published 6 years ago

ngx-presson v0.2.2

Weekly downloads
5
License
MIT
Repository
github
Last release
6 years ago

ngx-presson

Angular 2+ directive that will increment (or decrement) a counter variable while your element is being pressed. Similar to Medium's claps.

Preview in Plunker

About Medium's Claps

npm version license

Installation

NPM

To install this library, run:

$ npm install ngx-presson --save

Usage

Add the directive in any element of your Angular application's template:

<!-- You can now use your library directive in app.component.html -->
<h1>{{title}}</h1>
<p><button [(presson)]="counter">Presson</button></p>
<p>Counter: {{counter}}</p>

In your Angular AppModule, import the library:

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

// Import the library
import { PressonModule } from 'ngx-presson';

@NgModule({
  bootstrap: [ AppComponent ],
  declarations: [ AppComponent ],
  imports: [
    BrowserModule,
    // Specify the library as an import
    PressonModule
  ]
})
export class AppModule {}

@Component()
class AppComponent {

counter = 0;

}

Parameters

ParameterTypeDefaultDescription
pressonnumbernullCounter value
pressonSpeednumber100Counting speed in milliseconds
pressonWaitnumber0Delay in ms before counting starts after the mouse press
pressonChangeeventnullChange event to implement if using 'presson' for multiple elements

License

MIT © Kris Nyunt

0.2.2

6 years ago

0.2.1

6 years ago

0.2.0

6 years ago