Last active
January 1, 2016 14:09
-
-
Save jharding/8156044 to your computer and use it in GitHub Desktop.
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
<div class="example-twitter-oss"> | |
<input class="typeahead" type="text" placeholder="open source projects by Twitter"> | |
</div> |
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
var repos = new Bloodhound({ | |
datumTokenizer: function(d) { return d.tokens; }, | |
queryTokenizer: Bloodhound.tokenizers.whitespace, | |
prefetch: '../data/repos.json' | |
}); | |
repos.initialize(); | |
$('.example-twitter-oss .typeahead').typeahead(null, { | |
name: 'twitter-oss', | |
displayKey: 'name', | |
source: repos.ttAdapter(), | |
templates: { | |
suggestion: Handlebars.compile([ | |
'<p class="repo-language">{{language}}</p>', | |
'<p class="repo-name">{{name}}</p>', | |
'<p class="repo-description">{{description}}</p>' | |
].join('')) | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment