Ho un'applicazione Angular in esecuzione nel mio progetto ruby on rails e ora voglio implementare una ricerca typeahead usando angular.js e non riesco a trovare la soluzione come fare typeahead directive running
.Impossibile caricare template: template/typeahead/typeahead.html in Ruby on rails app
Domanda: Come installare la direttiva angolare typeahead nel mio progetto?
Con la soluzione attuale descritto muggito sto ottenendo questa console:
Failed to load resource: the server responded with a status of 404 (Not Found) http://localhost:3000/template/typeahead/typeahead.html
- ng-app funziona e js e dei file correlati css legata in html pure.
Sto seguendo questa fonte: bootstrap-ui-angularjs
Quello che ho fatto già:
- scaricato
angular-ui-bootstrap.js
inpublic\assets\javascripts
directory manifestato un'attività condotta come di solito:
// = richiede jquery // = richiede jquery_ujs // = richiede jquery.tokeninput // = richiede bootstrap // = richiede angolare // = richiede angular-ui-bootstrap // = require_tree.
3.checked se js
sono sulla pagina: (solo gli script in questione)
<link href="/assets/bootstrap.css?body=1" media="all" rel="stylesheet" type="text/css" />
<script src="/assets/bootstrap.js?body=1" type="text/javascript"></script>
<script src="/assets/angular.js?body=1" type="text/javascript"></script>
<script src="/assets/angular-ui-bootstrap.js?body=1" type="text/javascript"></script>
my ng-app:
<div ng-app='plunker'>
<div class='container-fluid' ng-controller="TypeaheadCtrl">
<pre>Model: {{result | json}}</pre>
<input type="text" ng-model="result" typeahead="suggestion for suggestion in cities($viewValue)">
</div>
</div>
<script>
angular.module('plunker', ['ui.bootstrap']);
function TypeaheadCtrl($scope, $http, limitToFilter) {
//http://www.geobytes.com/free-ajax-cities-jsonp-api.htm
$scope.cities = function(cityName) {
return $http.jsonp("http://gd.geobytes.com/AutoCompleteCity?callback=JSON_CALLBACK &filter=US&q="+cityName).then(function(response){
return limitToFilter(response.data, 15);
});
};
}
</script>
C'è qualcosa che cosa manco in relazione all'installazione direttive angolari esistenti ? per esempio. da this link
Non è necessario scaricare e aggiungere manualmente il file: https://github.com/angular-ui/bootstrap-bower/issues/9 – tatsuhirosatou