Tag: angular ui typeahead

Ui.Bootstrap Typeahead不能使用Async调用

我正在使用ui.bootstrap typeahead与asynchronous调用。 然而,由此产生的数据似乎没有find方式返回到前面的指令,随后没有下拉与数据出现。 该html是 <input type="text" ng-model="asyncSelected" placeholder="Search Profile" typeahead="username.username for username in getSearch($viewValue)" typeahead-wait-ms="400" class="form-control"> JSfunction在这里 $scope.getSearch = function (val) { return $sails.get("/search/" + val).success(function (response) { console.log(response); return response.map(function (item) { console.log(item.username); return item.username; }); }).error(function (response) { console.log('The sails profile search has failed'); }); } 响应JSON对象是 Object @type: "d" id: "#17:3" username: […]