In the final chapter, when doing autocomplete, I got an error said: TypeError: undefined is not an object (evaluating 'this.set('filteredList').clear')
when clearing the city input field.
Push the example to github and provide a link to the repository.
Git repo: https://github.com/daqing/super-rentals
I did a few modifications to the guide.
this.set('filteredList').clear();
You meant this.get('filteredList').clear()
No, it’s this.set('filteredList').clear();
, not get()
Do you understand you’re calling set and not passing a value to the setter but treating it like a getter since you’re calling clear on undefined, since set doesn’t return anything?
Please look at my pull request, that’s why I took the time to send it.
Whatever tutorial you’re reading was incorrect, or you misread.
Your PR works, thanks.
So the ember docs is wrong? I have another question: why not just set the property to empty array?
like this: this.set('filteredList', [])