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-partial-loader

v1.1.1

Published

Angular library that fills unresolved async content by simple partial loader

Downloads

15

Readme

ng-partial-loader

ng-partial-loader is an Angular library that fills unresolved async content by simple partial loader

Demo available @ https://cagcak.github.io/ng-partial-loader
StackBlitz available @ https://stackblitz.com/edit/ng-partial-loader

Table of contents

Installation

To add ng-partial-loader library to your package.json use the following command.

npm install ng-partial-loader --save

or

yarn add ng-partial-loader

After installation completed, define NgPartialLoaderModule to your module scope to use

import { NgModule } from '@angular/core';
import { NgPartialLoaderModule } from 'ng-partial-loader';
import { AppComponent } from './app.component';

@NgModule({
  declarations: [AppComponent],
  imports: [NgPartialLoaderModule],
  bootstrap: [AppComponent],
})
export class AppModule {}

then in angular.json define default loaders asset location to style bundle if it will be used

...
{
  ...
"architect": {
  "build": {
    ...
    "options": {
      ...
      "assets": [
        ...
        {
          "glob": "**/*",
          "input": "node_modules/ng-partial-loader/src/assets",
          "output": "./assets"
        }
      ],
    }
    ...
  }
}

Usage

ng-partial-loader requires a minimal directive definition to make loader available as in needed an alternative content with a boolean value to hide/show options as dynamically.

isHttpRequestResolved: boolean = false;
<div [ngPartialLoader]="isHttpRequestResolved">
  <span>This content will be available if isHttpRequestResolved is true</span>

  <div id="ng-partial-loader-uuid">
    this dynamic loader element added to dom when isHttpRequestResolved is true
  </div>
</div>

Options

ng-partial-loader has an NgPartialLoaderOptions named model

  • path: loader graph or vector path with forward slashes, ex: '/resources/images/loaders/'
  • fallback: fallbak loader file with extension, ex: 'loading.png'
  • customLoader: application specific loader, ex: 'loader.svg'
  • minHeight: minimum height for loader scope
  • loader: library based loader option, ex: 'blocks' | 'dual-ring' | ... etc

If there is not any option defined, the directive will have default animated cube loader.

Below demonstrates how to pass options

<div
  [ngPartialLoader]="isHttpRequestResolved"
  [loaderOptions]="{
    path: '/assets/my-images/',
    customLoader: 'bullets.gif'
  }"
>
  ...
</div>
<div [ngPartialLoader]="isHttpRequestResolved" [loaderOptions]="{ loader: 'ripple' }">...</div>

Contribution

Contributions are always welcome, just make sure that ...

  • Your code style matches with the rest of the project
  • Unit tests pass
  • Linter passes

Support Development

The use of this library is totally free and no donation is required.

License

Licensed under MIT.