Sto utilizzando RequireJS per caricare le mie dipendenze.
Ecco il mio file di configurazione:
requirejs.config({
baseUrl: "/js/dist",
paths: {
jquery: "../bower_components/jquery/dist/jquery.min",
bootstrap: "../bower_components/bootstrap/dist/js/bootstrap.min",
typeahead: "../bower_components/bootstrap3-typeahead/bootstrap3-typeahead.min",
validator: "../bower_components/bootstrapvalidator/dist/js/bootstrapValidator.min",
openlayers: "../vendor/openlayers/OpenLayers"
},
shim: {
bootstrap: {
deps: ["jquery"]
},
validator: {
deps: ["bootstrap"]
},
openlayers: {
exports: "OpenLayers"
}
}
});
E una parte del mio file dell'applicazione principale:
define(["jquery", "bootstrap", "openlayers", "./popup", "typeahead"], function($, Bootstrap, OpenLayers, Popup) {
(...)
$("#textSearch").typeahead("destroy");
(...)
});
Ispezione con Firebug, vedo che tutte le dipendenze sono stati caricati. Ma chiamando typeahead()
nella casella di testo di ricerca viene visualizzato il seguente messaggio: "TypeError: $(...).typeahead is not a function"
Non riesco a capire questo errore, dal momento che tutte le dipendenze (così come typeahead) vengono caricate.
Potete aiutarmi? Grazie in anticipo
Ottenere lo stesso errore, provato tutto. Tornato a una versione precedente, 0.9.3 e che è riuscito a farlo funzionare. – Frisbetarian