Angular directive for repeating HTML element by count
npm install ngx-repeat







> Angular directive for repeating HTML element by count
> ✓ _Angular 20 compatible_
Here's the demo or stackblitz live preview or codesandbox live preview
- Lightweight
- No dependencies!
- Directive way
1. Use yarn (or npm) to install the package
``terminal`
yarn add ngx-repeat
2. Add NgxRepeatDirective into your component
``typescript
import { NgxRepeatDirective } from 'ngx-repeat';
@Component({
standalone: true,
imports: [NgxRepeatDirective /, .../],
// ...
})
`
or module
`typescript
import { NgxRepeatDirective } from 'ngx-repeat';
@NgModule({
// ...
imports: [
// ...
NgxRepeatDirective
]
})
`
`html
*ngxRepeat="3;
let index = index;
let even = even;
let odd = odd;
let first = first;
let last = last;"
>
{{ index }} {{ even }} {{ odd }} {{ first }} {{ last }}
$3
`code
0 true false true false
1 false true false false
2 true false false true
`🔧 Compatibility
| Angular | ngx-repeat | Install |
| --------- | ---------- | ----------------------- |
| >= 20 | 4.x |
yarn add ngx-repeat |
| >= 19 | 3.x | yarn add ngx-repeat@3 |
| >= 14 | 2.x | yarn add ngx-repeat@2 |
| >= 12 | 1.x | yarn add ngx-repeat@1 |
| >= 5 < 13 | 0.x | yarn add ngx-repeat@0` |_None_
Copyright © 2021 - 2025 Dominik Hladik
All contents are licensed under the [MIT license].
[mit license]: LICENSE