kbarendrecht / ngx-for-else

A convenience directive to add empty states more easily.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ngx-for-else

This library extends ngFor (only when imported) with the ability to provide a template for when there is nothing to loop over.

<div *ngFor="let item of items; else emptyTemplate">
  {{ item | json }}
</div>

<ng-template #emptyTemplate>
  No items
</ng-template>

intellij import


Installation

npm i ngx-for-else

License

MIT


Special thanks

Aubrey Harris for suggesting the syntax

Pete Bacon Darwin for making a simple solution

About

A convenience directive to add empty states more easily.


Languages

Language:TypeScript 59.9%Language:JavaScript 40.1%