@Shola wrote:
I am trying to create a search in ionic 5 and i keep getting this error. i discovered that the filter is not returning an array but JSON, i don’t know why this is happening. i am fetching my data from firebase and push the content to an array, it is from this array i want to search for topics.
Please check my code and the picture reference of the data i have in my posts arraysearchTopics(event:any) { const searchQuery = event.target.value; console.log(this.posts) this.posts = this.posts.filter(ret => { if (ret.topic && searchQuery ) { if (ret.topic.toLowerCase.indexOf(searchQuery.toLowerCase()) > -1) { return true; } return false; } }) }
Posts: 1
Participants: 1