Skip to content

Commit

Permalink
Merge pull request #9 from runartrollet/typeaheadoptions
Browse files Browse the repository at this point in the history
Can now add options to typeahead.
  • Loading branch information
mdarens committed Sep 5, 2017
2 parents fbffa4c + ccb2330 commit 83b745e
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions knockout.typeahead.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ ko.bindingHandlers.typeahead = {
var mapping = ko.unwrap(allBindings().mappingFunction);
var onSelect = allBindings.get("onSelectFunction");
var displayedProperty = ko.unwrap(allBindings().displayKey);
var user_typeahead_options = ko.unwrap(allBindings().typeaheadOpts) || {};
var value = allBindings.get("value");

var url = ko.unwrap(valueAccessor());
Expand Down Expand Up @@ -69,10 +70,10 @@ ko.bindingHandlers.typeahead = {
}

$(element)
.typeahead({
.typeahead(jQuery.extend({
hint: true,
highlight: true
}, typeaheadOpts)
highlight: true,
}, user_typeahead_options), typeaheadOpts)
.on("typeahead:selected typeahead:autocompleted", function (e, suggestion) {
if (onSelect) {
onSelect(value, suggestion, e)
Expand Down

0 comments on commit 83b745e

Please sign in to comment.