Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@ngx-utilities/ngx-if-else-loading

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ngx-utilities/ngx-if-else-loading

[![npm version](https://badge.fury.io/js/%40ngx-utilities%2Fngx-if-else-loading.svg)](https://www.npmjs.com/package/@ngx-utilities/ngx-if-else-loading)

  • 0.0.2
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

ngx-if-else-loading

npm version

The *ngxIfElseLoading directive is a drop-in replacement for *ngIf that shows a loading animation while the condition is falsy (i.e. while content is loading).

Installation

To install this library, run:

npm install @ngx-utilities/ngx-if-else-loading --save -or- yarn add @ngx-utilities/ngx-if-else-loading

and then import and export NgxIfElseLoadingModule in your Angular SharedModule:

// shared.module.ts

import { NgxIfElseLoadingModule } from '@ngx-utilities/ngx-if-else-loading';

@NgModule({
  imports: [
    NgxIfElseLoadingModule
  ],
  exports: [
    NgxIfElseLoadingModule
  ]
})
export class SharedModule { }

With a custom loading spinner

You can provide a custom loading component. It can be anything you want, it just has to accept a message input. If your custom loading component is named MyLoadingComponent, the setup will look like this:

// shared.module.ts

@NgModule({
  imports: [
    NgxIfElseLoadingModule.withCustomLoadingComponent(MyLoadingComponent)
  ],
  declarations: [
    MyLoadingComponent
  ],
  entryComponents: [
    MyLoadingComponent
  ]
  exports: [
    NgxIfElseLoadingModule
  ]
})
export class SharedModule { }

Usage

<ng-container *ngxIfElseLoading="items | async; let items">
  ...content
</ng-container>

With a custom message

<ng-container *ngxIfElseLoading="items | async; let items; withMessage 'Loading items...'">
  ...content
</ng-container>

License

MIT © Kevin Phelps

FAQs

Package last updated on 15 Jul 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc