Angular 7からAngular 8にアップグレードした後、パイプがエラーで動作しなくなりました。
TypeError: undefined is not iterable (cannot read property Symbol(Symbol.iterator))
10 | export class APipe implements PipeTransform {
11 |
> 12 | constructor(
| ^
13 | private readonly bPipe: BPipe,
14 | private readonly cPipe: CPipe) {}
または同様のエラーで:
Error: Found non-callable @@iterator
私のパイプのコード:
@Pipe({
name: 'aPipe'
})
export class APipe implements PipeTransform {
constructor(
private readonly bPipe: BPipe,
private readonly cPipe: CPipe) {}
transform(someValue: any, args?: any): any {
if (!someValue) {
return ' — ';
}
if (cond1) {
return this.bPipe.transform(someValue, ...args);
}
else {
return this.cPipe.transform(someValue, ...args);
}
return ' — ';
}
}
Angular8でパイプを@Injectable()
として明示的にマークする必要がありますか、問題は何ですか?