autoc
v0.0.2
Published
autocomplete
Downloads
6
Readme
Autoc
Autocomplete with optional Handlebars templates.
##Usage
var Autoc = require('autoc');
var input = document.querySelector('#id_username');
var autoc_options = {
'suggestionTemplate': null,
// ID of handlebars template,
'minQueryLength': 2,
// Only send ajax request if length of input exceeds this value
'queryParamter': 'search',
// Query parameter to add to API url. e.g., /api/users/?search=query
'throttle': 10,
// Send ajax request only every 10 miliseconds
'listAlign': 'left',
// Align dropdown to left or right of parent element
'listClasses': [],
// Classes to apply to the dropdown list
'itemClasses': [],
// Classes to apply to autocomplete item results
'valueParameter': null,
// JSON property in each item of the response that maps to the search input
}
var autocomplete = Autoc(input, '/api/users/', autocomplete_options);