Created
April 10, 2013 06:12
-
-
Save chadedrupt/5352196 to your computer and use it in GitHub Desktop.
Bootstrap Typeahead Custom Knockout Binding
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ko.bindingHandlers.typeahead = { | |
init: function (element, valueAccessor, allBindingsAccessor, viewModel, bindingContext) { | |
$(element).typeahead(); | |
}, | |
update: function (element, valueAccessor, allBindingsAccessor, viewModel, bindingContext) { | |
var value = ko.utils.unwrapObservable(valueAccessor()); | |
$(element).data('typeahead').source = value; | |
} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment