README.md

July 27, 2026 ยท View on GitHub

NgxSuspenseOf

npm version Package License NPM Downloads Snyk codecov stars forks HitCount

Angular directive for repeating HTML element by count

โœ“ Angular 22 compatible

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

  • Lightweight
  • No dependencies!
  • Directive way

๐Ÿ› ๏ธ Install

  1. Use Bun to install the package
bun 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
>= 224.xbun add ngx-suspense-of
>= 203.xbun add ngx-suspense-of@3
>= 142.xbun add ngx-suspense-of@2
>= 121.xbun add ngx-suspense-of@1
>= 5 < 130.xbun add ngx-suspense-of@0

๐Ÿ“ฆ Dependencies

None

๐Ÿชช License

Copyright ยฉ 2021 - 2026 Dominik Hladik

All contents are licensed under the MIT license.