npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

ng-form-debounce-click

v1.0.0

Published

* A simple `directive` with no extenal dependencies. * Library location: `projects/form-debounce-click` directory of this repository. * works for Angular 8 and above in all devices.

Downloads

5

Readme

NgFormDebounceClick

  • A simple directive with no extenal dependencies.
  • Library location: projects/form-debounce-click directory of this repository.
  • works for Angular 8 and above in all devices.

Examples/Demo

  • A simple Example can be found under src/app directory of this repository.

@Inputs()

| Input | Type | Required | Description| | --------------------- | ------- | -------------------------- | ------------------------------------------------------------------------------------------------------------------- | | validateForm | FormGroup | optional | if validateForm is invalid the click event will be blocked | | markFormAsTouched | boolean | Optional, default: true | if markFormAsTouched is true, All the controls in validateForm will be marked as touched on click. | | debounceTime | number | Optional, default: 300 | only one click will be emitted even mutliple click events happened in the given debounceTime |

@Outputs()

| Output | Type | Required | Description | | ----------------------- | ---------- | -------- | ------------------------------------------------------ | | ngFormDebounceSubmit | void> | YES | emits a debounce click event after checking the validateForm validity if exists | | ngFormInvalid | void> | YES | emits a event on click if the validateForm is invalid |

Usage

  1. Register the NgFormDebounceClickModule in your app module. > import { NgFormDebounceClickModule } from 'ng-form-debounce-click'
import { AppComponent } from './app.component';
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
import { NgFormDebounceClickModule } from 'projects/ng-form-debounce-click';


@NgModule({
 declarations: [
   AppComponent
 ],
 imports: [
   BrowserModule,
   FormsModule,
   ReactiveFormsModule,
   NgFormDebounceClickModule
 ],
 providers: [],
 bootstrap: [AppComponent]
})
export class AppModule { }
  1. Use the directive (NgFormDebounceClickDirective) in your component.
import { Component } from '@angular/core';
import { FormGroup, FormControl, Validators } from '@angular/forms';

@Component({
  selector: 'app-root',
  template: `
  <div class="container">
  <div class="form" [formGroup]="formGroup">
    <label for="name"><b>Name</b></label>
    <input type="text" formControlName="Name">
    <p class="error" *ngIf="formGroup.controls.Name?.errors?.required && formGroup.controls.Name?.touched">Name is required</p>
  
    <label for="ssn"><b>SSN</b></label>
    <input type="text"  formControlName="SSN">
    <p class="error" *ngIf="formGroup.controls.SSN?.errors?.required && formGroup.controls.SSN?.touched">SSN is required</p>
      
    <button ngFormDebounceClick [validateForm]="formGroup" (ngFormDebounceSubmit)="submit()">Submit</button>
  </div>
</div>
`,
  styleUrls: ['./app.component.css']
})
export class AppComponent implements OnInit {

}

Running the example in local env

  • npm i
  • Run ng serve for a dev server and running the demo app. Navigate to http://localhost:4200/. The app will automatically reload if you change any of the source files.