Angular 未填充内容

Angular typeahead not populating content

我在 angular.js 中使用 typeahead 遇到了一些严重的问题。数据没有填充甚至很难我可以在与 typehead 属性链接的函数中看到,对象正在退出

我控制器的相关部分:

angular.module('rechnungCtrl', ['rechnungService','kundeService'])

.controller('RechnungController', function(Rechnung, Kunde, $route, $routeParams, $location, $http) {

vm.searchKunde = function(val) {

        Kunde.search(val)
            .success(function(data) {
                //When seting a breakpoint in chrome here i can see that the data is correctly loaded from the REST Service
                return data;
        });
    }

我的相关部分观点:

<input type="text" class="form-control" id="kunde" placeholder="Kunde" typeahead="obj.vorname for obj in ctrl.searchKunde($viewValue)" ng-model="ctrl.selectedKunde">

模块的使用

angular.module('EasyApp', ['ngBootbox', 'ui.bootstrap'])

最后是index.html

的相关部分
<link href="app/views/bower_components/angular-bootstrap/ui-bootstrap-csp.css"></script>
<script src="app/views/bower_components/angular-bootstrap/ui-bootstrap.min.js"></script>
<script src="app/views/bower_components/angular-bootstrap/ui-bootstrap-tpls.js"></script>

非常感谢对这个问题的任何帮助!!

BR, 马丁

问题出在函数 vm.searchKunde 上。此函数不返回任何内容,因此不填充预输入值。尝试返回承诺,即:

vm.searchKunde = function(val) {
    return Kunde.search ...
}