【发布时间】:2020-02-08 05:05:49
【问题描述】:
这是错误信息: 错误类型错误:无法读取未定义的属性“过滤器”
HTML
<ion-searchbar (ionChange)=search($event) color='medium'></ion-searchbar>
ts
allMessages: message[];
messages : message[];
search(event) {
const text = event.target.value;
if (text && text.trim() !== '') {
this.room.messages = this.allMessages.filter(
message => message.content.toLowerCase().includes(text.toLowerCase()));
} else {
// Blank text, clear the search, show all products
this.room.messages = this.allMessages;
}
}
【问题讨论】: