Skip to content
This repository has been archived by the owner on Nov 30, 2022. It is now read-only.

fivethree-team/async-pipes

Repository files navigation

Async Pipes

npm version

RxJS async pipes for Angular

📦 Installation

To get started, install the package from npm. The latest version supports Angular 7 and above.

You can use either npm or yarn to install @fivethree/async-pipes from npm.

npm install @fivethree/async-pipes --save

# or if you are using yarn
yarn add @fivethree/async-pipes

🔨 Usage

Import the pipe module you like to use into your page or components module:

import { NgModule } from '@angular/core';
import { PendingPipeModule } from '@fivethree/async-pipes';

@NgModule({
    imports: [
        PendingPipeModule
    ]
})
export class HomePageModule {}

Pipes

EmptyPipe -> empty

<div *ngIf="numbers$ | empty | async">
    Empty State - Source Observable emitted an empty array
</div>

ErrorPipe -> error

 <div *ngIf="numbers$ | error | async as error">
    {{error}}
</div>

PendingPipe -> pending

<div *ngIf="numbers$ | pending | async">
    Pending State - Source Observable has not emitted yet
</div>