Created by: iamnirav
This update separates out the code that updates the input field once a user selects a typeahead item. It also adds in an option for a developer to override this function. This means you can specify something like
var updater = function (item) {
var tokens = this.query.split(' ');
// Replace last (incomplete) token with completed selection
tokens.splice(-1, 1, item + ' ');
return tokens.join(' ');
}
to have a typeahead where you can string together a chain of autocompleted tokens.