Meteor-Community-Packages / meteor-autocomplete

Client/server autocompletion designed for Meteor's collections and reactivity.
https://atmospherejs.com/mizzao/autocomplete
MIT License
350 stars 109 forks source link

Uncaught TypeError: Cannot read property 'limit' of undefined #82

Closed woniesong92 closed 9 years ago

woniesong92 commented 9 years ago

When I include the following

{{> inputAutocomplete settings=settings id="msg" class="input-xlarge" placeholder="Courses..."}}

inside my template, it seems settings is undefined.

I defined settings function as a helper method inside a template. Is this issue only happening to me?

mizzao commented 9 years ago

Yeah, you probably defined it as a helper on the wrong template. Good to double check.

chackerian commented 9 years ago

I'm getting this same error although I do not use the settings attribute

{{> esInput index="listing" id="search" class="search" placeholder="Brand, Name, Neighborhood, Size, Price..."}}

Have I not already declared limit when I create the search index ( 'limit' : 20 ) ?

EasySearch.createSearchIndex('listing', {
  'collection': Listing,
  'field': [
  'createdAt',
  'listing_title',
  'category',
  'username',
  'price', 
  'city',
  'state', 
  'size'
  ], // array of fields to be searchable
  'limit' : 20,
  'use' : 'mongo-db',
  'props': {
    'sortBy': 'price'
  },
  'sort': function () {
    if (this.props.sortBy === 'listing_title') {
      return { 'listing_title': 1 };
    }  
  },
  'query': function (searchString) {
    var query = EasySearch.getSearcher(this.use).defaultQuery(this, searchString);
    return query;
  }
});
mizzao commented 9 years ago

@chackerian I think that is a different package: https://github.com/matteodem/meteor-easy-search