0
我有一些嚴重的麻煩在angular.js中使用typeahead。該數據不填充甚至強硬。我可以與typehead屬性鏈接的功能看,該對象退出角度typeahead不填充內容
我的控制器的相關部分:
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, 馬丁
JavaScript控制檯中的任何錯誤?順便說一下,如果您引用'ui-bootstrap-tpls.js',則不必引用'ui-bootstrap(.min).js'。這最後一個腳本包含所有帶html模板的ui-bootstrap代碼。另外,在JS控制檯中app/views' –
沒有錯誤的情況下使得bower_components非常奇怪。感謝與ui-bootstrap.js的提示。我刪除它。涼亭組件通常去哪裏?我現在添加了編碼,用於在未找到結果時顯示無結果區域。當我執行搜索時,沒有結果函數被觸發。所以看起來數據沒有被傳輸。我也將Kunde.search從.success改爲.then。仍然得到相同的錯誤 – Martin
理想情況下'app'文件夾應該只包含特定於應用程序的代碼,'bower_components'是'app'的兄弟文件夾 –