【发布时间】:2020-04-14 01:18:14
【问题描述】:
我收到此错误 ERROR TypeError: ERROR TypeError: array.map is not a function error while using this angular pipe and here is code.
export class CharacterWithCommasPipe implements PipeTransform {
transform(array) {
return array.map(item => item.name).join(', ');
}
}
【问题讨论】:
-
请同时发布使用此管道的视图代码,您很可能将一些不是数组的东西放入管道中
-
对象,{},在 JavaScript 中没有方法 .map()。所以请确保它。
标签: javascript angular angular8 angular-pipe