Skip to content

Instantly share code, notes, and snippets.

@alexzuza
Created July 8, 2019 05:23
Show Gist options
  • Save alexzuza/bc24f6ddcacf0fad1b944ca5fb88341e to your computer and use it in GitHub Desktop.
Save alexzuza/bc24f6ddcacf0fad1b944ca5fb88341e to your computer and use it in GitHub Desktop.
t19
export class NgForOfContext<T> {
constructor(
public $implicit: T, public ngForOf: NgIterable<T>, public index: number,
public count: number) {}
get first(): boolean { return this.index === 0; }
get last(): boolean { return this.index === this.count - 1; }
get even(): boolean { return this.index % 2 === 0; }
get odd(): boolean { return !this.even; }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment