ngx-repeat

Angular directive for repeating HTML element by count

Usage no npm install needed!

<script type="module">
  import ngxRepeat from 'https://cdn.skypack.dev/ngx-repeat';
</script>

README

NgxRepeat

npm version Package License NPM Downloads Build & Publish codecov stars forks HitCount

Angular directive for repeating HTML element by count

Angular 13, Ivy and SSR compatible

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

  • Lightweight
  • No dependencies!
  • Directive way

Install

  1. Use yarn (or npm) to install the package
yarn add ngx-repeat
  1. Add NgxRepeatModule into your module imports
  import { NgxRepeatModule } from 'ngx-repeat';

  @NgModule({
   // ...
   imports: [
     // ...
     NgxRepeatModule
   ]
  })

Compatibility

Angular ngx-repeat Install
>= 12 1.x yarn add ngx-repeat
>= 5 < 13 0.x yarn add ngx-repeat@0

Quick start

Example code

<div
  *ngxRepeat="3; 
    let index = index;
    let even = even;
    let odd = odd;
    let first = first;
    let last = last;"
>
  {{ index }} {{ even }} {{ odd }} {{ first }} {{ last }}
</div>

Result

  0 true false true false
  1 false true false false
  2 true false false true

Dependencies

None

License

Copyright © 2021 - 2022 Dominik Hladik

All contents are licensed under the MIT license.