Get length of array in ngFor after pipes transformation

前端 未结 4 2145
走了就别回头了
走了就别回头了 2021-02-19 10:57

I have the following template:

4条回答
  •  佛祖请我去吃肉
    2021-02-19 11:34

    Well, this is not well documented in the Angular doc, you can find under source code of Angular at -

    https://github.com/angular/angular/blob/master/packages/common/src/directives/ng_for_of.ts

    *ngFor accepts count params.

    constructor(public $implicit: T, public ngForOf: NgIterable, public index: number,public count: number) {
    }
    

    So we can get the count like -

    {{count}}

提交回复
热议问题