Angular 6 找不到管道 'index'

Angular 6 The pipe 'index' could not be found

目前在使用 Angular 6 时,当我尝试为 NgFor 使用索引管道时出现以下错误:

Uncaught Error: Template parse errors:
The pipe 'index' could not be found ("
<ul class="list-unstyled"> <li *ngFor="l[ERROR ->]et s of grouplesson.start | index as i">
<span cl"): ng:///ModalModule/GrouplessonsComponent.html@80:61

代码片段:

<li *ngFor="let s of grouplesson.start | index as i">
    <span class="time__start">{{s | date:'HH:mm'}}</span>
    <span> - </span>
    <span class="time__end">{{grouplesson.end[i] | date:'HH:mm'}}</span>
</li>

我觉得这很奇怪,因为循环在不使用管道时确实有效,而且据我所知,我还在 ModalModule 中正确导入了 commonmodule:

import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { ModalComponent } from './modal.component';

import { ModalService } from './services/modal.service';
import { GrouplessonsComponent } from './components/grouplessons/grouplessons.component';

@NgModule({
  imports: [
    CommonModule
  ],
  declarations: [ModalComponent, GrouplessonsComponent],
  providers: [ModalService],
  exports: [ModalComponent, GrouplessonsComponent]
})
export class ModalModule { }

我在这里错过了什么?

没有index管道。您需要使用赋值语法并用分号分隔循环和赋值语句:

<li *ngFor="let s of grouplesson.start; let i = index">