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 🙏

© 2026 – Pkg Stats / Ryan Hefner

ngx-disable-during-ajax

v1.0.2

Published

This is a library to 'disable' any element in your application using a specified css class whilst ajax data calls are in transit

Downloads

61

Readme

ngx-disable-during-ajax

This is an accessible library to style any element in your application (illustrating that it is unavailable) whilst ajax data calls are in transit. We achieve this by applying a css class name and we avoid using the 'disabled' attribute altogether.

Stackblitz Example = https://stackblitz.com/edit/angular-ivy-fmn28n

Description

Sometimes we may want to illustrate that buttons (or other elements) are unavailable in our application whilst ajax calls are in transit. For example the user may have filled out an order form and we wish to prevent them from accidentally pressing the submit button twice. This library listens for all the incoming and outgoing requests and adds / removes a css class where necessary.

Get Started

Step 1: install ngx-disable-during-ajax

npm i ngx-disable-during-ajax

Step 2: Import DisableDuringAjaxModule into your app module, eg.:

import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { HttpClientModule } from '@angular/common/http';
import { AppRoutingModule } from './app-routing.module';
import { AppComponent } from './app.component';

import { DisableDuringAjaxModule } from 'ngx-disable-during-ajax';

@NgModule({
  declarations: [AppComponent],
  imports: [
    BrowserModule,
    AppRoutingModule,
    HttpClientModule,
    DisableDuringAjaxModule.forRoot(),
  ],
  providers: [],
  bootstrap: [AppComponent],
  ],
})
export class AppModule { }

Styling

Step 3: In your global stylesheet, style the provided ngx-disable-during-ajax-disabled class name, eg:

.ngx-disable-during-ajax-disabled{
    pointer-events: none;
    opacity: 0.5;
}

Please note in this library we don't use the disabled attribute since this isn't accessible for screenreaders. By providing a class name that you can style yourself gives you greater flexibility as to how those 'disabled' elements should look and behave.

Usage

Step 4: Place directive on buttons you wish to disable when ajax calls are made

<button type="button" [ngxDisableDuringAjax]>My button</button>

Should you have buttons which are included in a form and need validation to be considered include the form name as a parameter to the tag.

<button type="button" [ngxDisableDuringAjax]="myForm">My button</button>

Skipping certain api calls from disabling elements

You may have a situation where you want your button to be 'disabled' for all ajax calls with the exception of a few. For example you may have to call a 'new messages' api every 10 seconds which would affect the user's experience if buttons were going in and out of a 'disabled' state every 10 seconds. In this case, simply add a "NgxDisableDuringAjaxSkip", "true", header to those http.service calls.

getWaterPokemon(): Observable<any[]> {
        return this.http
            .get<any[]>(`${this.getApi()}/type/5`,  { responseType: 'json', headers: new HttpHeaders().set("NgxDisableDuringAjaxSkip", "true") })
            .pipe(
              catchError((err) => {
                return this.errorHandler(err);
              }),
              map((clients: any) =>
                clients.pokemon.map((client: any) => client.pokemon)
              )
            );
      }