Skip to content

Lonli-Lokli/ng-result

Repository files navigation

MIT

Angular Library with set of components/directives/pipes for easier work with data, using https://github.com/Lonli-Lokli/ts-result

Demo

About

Result is an union of few types: ResultInitial, ResultPending, ResultFailure and ResultSuccess.

While your data in initial or pending state just use initial() or pending(), because you don't have any real values in this case. When you receive data from server, use failure or success function, it depends on what you received.

Installation

ng add @lonli-lokli/ng-result

Usage

<ll-result [data]="data$ | async">
  <ng-container *ifSuccess="data$ | async; let ok">
    Here is the response: {{ok}}
  </ng-container>
</ll-result>