Uncaught ReferenceError: Bloodhound is not defined

iajnr picture iajnr · Feb 21, 2015 · Viewed 10.6k times · Source

I am using the type ahead address picker given here

1) Have included google map and typeahead. Jquery is added through a gem and referenced in application.js

<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false&libraries=places&language=en-US"></script>
<script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/typeahead.js/0.9.3/typeahead.min.js"></script>
<script type="text/javascript" src="https://rawgithub.com/sgruhier/typeahead-addresspicker/master/dist/typeahead-addresspicker.js"></script>

2)Have added input text

<input id="address" type="text" placeholder="Enter an address">

3)Have instantiated address picker and typeahead.

$(document).on('ready page:load', function () {
    var addressPicker = new AddressPicker();

             $('#address').typeahead(null, {
                              displayKey: 'description',
                              source: addressPicker.ttAdapter()
              });

});

Answer

iajnr picture iajnr · Feb 22, 2015

Issue was resolved here
Should have included https://twitter.github.io/typeahead.js/releases/latest/typeahead.bundle.js for typeahead + bloodhound