1.3.0 • Published 2 years ago

@lonli-lokli/ng-result v1.3.0

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

Ng-Result is an Angular Library with set of components/directives/pipes for easier work with data, using Ts-Result

GitHub release (latest by date) GitHub commit activity GitHub license NPM

Demo

About

Result is an union of following types: Initial, Pending, Failure and Success.

The problem it solving present is a very common one. You are loading a list of things but instead of showing a loading indicator you just see zero items. Same happens with actual data loading - sometimes you just do not think it will fail.

In my mental model, REST requests have one of four states:

  • We haven't asked yet.
  • We've asked, but we haven't got a response yet.
  • We got a response, but it was an error.
  • We got a response, and it was the data we wanted.

That is the purpose of this library - allow clean usage over this states with Angular.

Installation

ng add @lonli-lokli/ng-result

Usage of components

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

Components

TODO

Publish

Run npm run publish

1.3.0

2 years ago

1.2.0

3 years ago

1.1.0

3 years ago

1.0.2

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago