Zwischenstand neues Type Ahead mit

https://angular-ui.github.io/bootstrap/#/typeahead
This commit is contained in:
2016-05-30 16:59:04 +02:00
parent 64fc16e5a7
commit 2724df1b23
13 changed files with 564 additions and 312 deletions
+15 -1
View File
@@ -1,6 +1,6 @@
var transactionControllers = angular.module('transactionControllers', ['ngResource']);
transactionControllers.controller('TransactionListCtrl', [ '$scope', '$location', '$resource', '$q', function($scope, $location, $resource, $q) {
transactionControllers.controller('TransactionListCtrl', [ '$http', '$scope', '$location', '$resource', '$q', function($http, $scope, $location, $resource, $q) {
$scope.refreshList = function() {
@@ -232,6 +232,20 @@ transactionControllers.controller('TransactionListCtrl', [ '$scope', '$location'
});
}
$scope.getLocation = function(val) {
var suggestions = $resource('http://localhost:8080/transactions/search/descriptions', { accountId: $scope.account.id, prefix: val.toLowerCase() }).get();
return suggestions.$promise.then(function(data) {
console.log(suggestions);
var newSuggestions = new Array(suggestions._embedded.transactions.length);
for (i = 0; i < suggestions._embedded.transactions.length; i++) {
newSuggestions[i] = suggestions._embedded.transactions[i].description;
}
return newSuggestions;
});
};
// initialize (http://stackoverflow.com/a/25662066/3761783)
$scope.initList();