2.4.0 • Published 4 months ago

ngx-suspense-of v2.4.0

Weekly downloads
51
License
MIT
Repository
github
Last release
4 months ago

npm version Package License NPM Downloads Snyk codecov stars forks HitCount

Angular directive for repeating HTML element by count

Angular 19 compatible

Here's the demo or stackblitz live preview or codesandbox live preview

  • Lightweight
  • No dependencies!
  • Directive way

🛠️ Install

  1. Use yarn (or npm) to install the package
yarn add ngx-suspense-of
  1. Add NgxSuspenseOfDirective into your imports
import { NgxSuspenseOfDirective } from 'ngx-suspense-of';

@Component({
  standalone: true,
  imports: [
    // ...
    NgxSuspenseOfDirective
  ],
})

or

import { NgxSuspenseOfDirective } from 'ngx-suspense-of';

@NgModule({
 // ...
 imports: [
   // ...
   NgxSuspenseOfDirective
 ]
})

🚀 Quick start

Example code

<ng-container
  *ngxSuspense="
    let data of observable;
    loading: loading;
    empty: empty;
    error: error
    stateChangeFn: onStateChange"
>
  <pre>{{ data | json }}</pre>
</ng-container>
<ng-template #loading>Loading ...</ng-template>
<ng-template #empty>Incoming data are empty</ng-template>
<ng-template #error let-tryAgain let-error="error">
  <pre>{{ error }}</pre>
  <button (click)="tryAgain()">Try again</button>
</ng-template>
  public onStateChange = <T>(state: NgxSuspenseState<T>): void => {
    console.log(state);
  };

🔧 Compatibility

Angularngx-suspense-ofInstall
>= 142.xyarn add ngx-suspense-of
>= 121.xyarn add ngx-suspense-of@1
>= 5 < 130.xyarn add ngx-suspense-of@0

📦 Dependencies

None

🪪 License

Copyright © 2021 - 2025 Dominik Hladik

All contents are licensed under the MIT license.

2.3.0

7 months ago

2.4.0

4 months ago

2.2.1

8 months ago

2.2.0

10 months ago

2.1.0

1 year ago

2.0.1

1 year ago

2.0.0

1 year ago

1.1.0

2 years ago

1.0.6

2 years ago

1.0.5

2 years ago

1.0.4

3 years ago

1.0.3

3 years ago

1.0.2

3 years ago

1.0.1

4 years ago

0.0.5

4 years ago

0.0.4

4 years ago

0.0.3

4 years ago

0.0.2

4 years ago

0.0.1

4 years ago