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

ngx-loading-x

v1.0.3

Published

Multiple Loaders / spinners in angular with an optional blurry overlay

Downloads

545

Readme

GitHub issues npm NPM

Ngx Loading X

Demo

Check out the interactive live demo

Getting Started

Installation

Install ngx-loading-x from NPM using this command

npm install ngx-loading-x --save

Usage

Import NgxLoadingXModule into the root of your module

import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { CoreModule } from './core/core.module';
import { NgxLoadingXModule } from 'ngx-loading-x';
 
@NgModule({
  declarations: [AppComponent],
  imports: [
    BrowserModule,
    // Import NgxLoadingXModule
    NgxLoadingXModule
  ],
  providers: [],
  bootstrap: [AppComponent]
})
export class AppModule { }

create a boolean variable that is accessible from the component which will contain ngx-loading-x. This boolean is used as an input into ngx-loading to determine when the loading spinner is visible.

import { Component, OnInit } from '@angular/core';

@Component({
    //...
})
export class AppComponent implements OnInit {
    //...
    public loading = false;

    constructor() { }

    ngOnInit() { }

    registerTest() {
        // loading triggered
        this.load = true;

        setTimeout(() => {
            // loader stops after 5s
            this.load = false,
            // ..
            this.register = true;
        }, 5000)
    }
}

Include ngx-loading-x component selector to your app component templates, Set the [show] input variable of ngx-loading-x to point to your boolean i.e load, which will determine the ngx-loading-x visibility.

<ngx-loading-x [show]="load"></ngx-loading-x>

ngx-loading-x component selector attributes

ngx-loading-x component selector Attributes

| Attributes | Type | Required | Default | Description | | :--- | :--- | :--- | :--- | :--- | | show | boolean | optional | false | Determines the visibility of the loader | | bgLogoUrl | string | optional | (empty string) | Logo Url | | bgOpacity | number | optional | 5 | background opacity | | bgLogoUrlPosition | number | optional | bottom-right | Logo position. available positions can be accessed via POSITION | | bgLogoUrlSize | number | optional | 100 | Logo size | | spinnerType | string | optional | wandering-cubes | Spinner animation type. available types can be accessed via SPINNER | | spinnerSize | number | optional | 120 | Spinner size | | spinnerColor | string | optional | #dd1b16 | Spinner color | | spinnerPosition | string | optional | center-center | Spinner position. available positions can be accessed via POSITION |

NgxLoadingXBlur Directive

If you want your page content is blurred/frosted while showing the loading background overlay.

<div NgxLoadingXBlur [show]="load">
  <!-- This page content will be blurred/frosted when loading background overlay is showed -->
</div>
<ngx-loading-x [show]="load"></ngx-loading-x>

Attribute

| Attributes | Type | Required | Default | Description | | :--- | :---: | :---: | :---: | :--- | | bgBlur | boolean | optional | 5 | blurred/frosted background |

Custom configuration for NgxLoadingXModule

You can override the default configuration via forRoot() method.

import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { AppComponent } from './app.component';
import { NgxLoadingXConfig, POSITION, SPINNER, NgxLoadingXModule } from 'ngx-loading-x';


const ngxLoadingXConfig: NgxLoadingXConfig = {
  show: false,
  bgBlur: 2,
  bgOpacity: 5,
  bgLogoUrl: '',
  bgLogoUrlPosition: POSITION.topLeft,
  bgLogoUrlSize: 100,
  spinnerType: SPINNER.wanderingCubes,
  spinnerSize: 120,
  spinnerColor: '#dd0031',
  spinnerPosition: POSITION.centerCenter,
}

@NgModule({
  declarations: [
    AppComponent,
  ],
  imports: [
    BrowserModule,
    NgxLoadingXModule.forRoot(ngxLoadingXConfig)
  ],
  providers: [],
  bootstrap: [AppComponent]
})

export class AppModule { }

| Attributes | Type | Required | Default | Description | | :--- | :--- | :--- | :--- | :--- | | show | boolean | optional | false | Determines the visibility of the loader | | bgLogoUrl | string | optional | (empty string) | Logo Url | | bgOpacity | number | optional | 5 | background opacity | | bgBlur | boolean | optional | 5 | blurred/frosted background | | bgLogoUrlPosition | number | optional | bottom-right | Logo position. available positions can be accessed via POSITION | | bgLogoUrlSize | number | optional | 100 | Logo size | | spinnerType | string | optional | wandering-cubes | Spinner animation type. available types can be accessed via SPINNER | | spinnerSize | number | optional | 120 | Spinner size | | spinnerColor | string | optional | #dd1b16 | Spinner color | | spinnerPosition | string | optional | center-center | Spinner position. available positions can be accessed via POSITION |