Skip to content

Instantly share code, notes, and snippets.

@josx
Forked from jharding/sports.html
Last active August 29, 2015 13:56
Show Gist options
  • Save josx/9134760 to your computer and use it in GitHub Desktop.
Save josx/9134760 to your computer and use it in GitHub Desktop.
var nba = new Bloodhound({
datumTokenizer: function(d) { return Bloodhound.tokenizers.whitespace(d.team); },
queryTokenizer: Bloodhound.tokenizers.whitespace,
prefetch: '../data/nba.json'
});
var nhl = new Bloodhound({
datumTokenizer: function(d) { return Bloodhound.tokenizers.whitespace(d.team); },
queryTokenizer: Bloodhound.tokenizers.whitespace,
prefetch: '../data/nhl.json'
});
nba.initialize();
nhl.initialize();
$('.example-sports .typeahead').typeahead({
highlight: true
},
{
name: 'nba',
displayKey: 'team',
source: nba.ttAdapter(),
templates: {
header: '<h3 class="league-name">NBA Teams</h3>'
}
},
{
name: 'nhl',
displayKey: 'team',
source: nhl.ttAdapter(),
templates: {
header: '<h3 class="league-name">NHL Teams</h3>'
}
});
@lando2319
Copy link

Thank you for linking this to the Twitter Example. Very Helpful.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment