sergeyt / meteor-typeahead

Autocomplete package for meteor powered by twitter typeahead.js
https://atmospherejs.com/sergeyt/typeahead
MIT License
146 stars 82 forks source link

data-source parameter #154

Open leizard opened 8 years ago

leizard commented 8 years ago

Hi, thank you for awesome package. How could I use parameter in the data-source helper function. Some thing like this:

    <input class="form-control typeahead" name="team" type="text"
     placeholder="NBA teams"
     autocomplete="off" spellcheck="off"
     data-source="(customerCodes code)"
     data-select="selected"
     data-render="rendered"/>

and the helper:

Template.myTemplate.helpers({
    customerCodes: function(code) {
         return Customers.find({code: code}).fetch().map(function(it){ return {id: it._id, value: it.code};    });
    }
})

Thank you.

sergeyt commented 8 years ago

Hi @leizard, I think you could just return all customer codes and typeahead input does the rest, since it is autocomplete input :)