https://github.com/paveldymkov/ng-track-by
https://github.com/paveldymkov/ng-track-by
Last synced: 3 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/paveldymkov/ng-track-by
- Owner: PavelDymkov
- License: mit
- Created: 2021-08-08T13:13:32.000Z (almost 4 years ago)
- Default Branch: master
- Last Pushed: 2021-09-19T11:32:42.000Z (almost 4 years ago)
- Last Synced: 2025-03-16T05:32:06.615Z (4 months ago)
- Language: TypeScript
- Size: 263 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# trackBy and trackById directives


> Library for set a value of the ngForTrackBy without adding any code to a component using only a template.
## Usage
Add directive(s) to module:
```ts
import { CommonModule } from "@angular/common";
import { TrackByModule, TrackByIdModule } from "ng-track-by";@NgModule({
imports: [CommonModule, TrackByModule, TrackByIdModule],
declarations: [MyComponent],
})
export class MyComponentModule {}
```Now you can use `trackBy` and `trackById`:
```html
- {{ user.name }}
- {{ item.value }}
```
The `trackById` is an alias for `trackBy="id"`.
The `trackBy` directive specifies the key in item of a collection according to which compute the identity of items.