Zwischenstand neues Type Ahead mit
https://angular-ui.github.io/bootstrap/#/typeahead
This commit is contained in:
@@ -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();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user