Angular, TypeError: Cannot read property 'toLowerCase' of undefined

后端 未结 2 1901
轻奢々
轻奢々 2020-12-19 18:50

i\'m trying to make a custom filter pipe by following this link, but i got error that said Angular, TypeError: Cannot read property \'toLowerCase\' of undefined

2条回答
  •  野趣味
    野趣味 (楼主)
    2020-12-19 19:06

    Is the attribute called 'name' or 'prdName' (the one you used in the template is 'prdName')?

    transform(values, args) {
        values.filter(
          product => product.prdName.toLowerCase().includes(args.toLowerCase())
        )
    }
    

提交回复
热议问题