mardi 16 février 2016

Ember 'Autocomplete Component' example bug?

I'm going through the Ember.js tutorial for Autocomplete and am looking at this piece of code:

export default Ember.Controller.extend({
  filteredList: null,
  actions: {
    autoComplete(param) {
      if(param !== "") {
        this.store.query('rental', {city: param}).then((result) => {
          this.set('filteredList',result);
        });
      }
      else {
        this.set('filteredList').clear();
      }
    },
    search(param) {
      if(param !== "") {
        this.store.query('rental', {city: param}).then((result) => {
          this.set('model',result);
        });
      }
      else {
        this.set('model').clear();
      }
    }
  }
});

What is the purpose of the .clear() in this.set('filteredList').clear();?

I can't seem to find any info about it and it is causing an Uncaught TypeError: Cannot read property 'clear' of undefined.




Aucun commentaire:

Enregistrer un commentaire