我首先尝试在$http service.At中使用angular-bootstrap的typeahead插件,我像这样使用$http.success():
$scope.filterProvinces = function(val){
return service.provinceList({
pageSize : 10,
queryKey : val
}).success(function(data, status, headers, config){
return data.data.list;
}
).error(function(data, status, headers, config){
alert("no result!");
return ;
});
}但它不起作用,所以我修改了代码,如下所示:
$scope.filterProvinces = function(val){
return service.provinceList({
pageSize : 10,
queryKey : val
}).then(function(response){
return response.data.data.list;
});
}它起作用了,所以我很困惑。为什么()是可以的,但是成功()是不正确的。
发布于 2015-09-02 10:26:15
https://stackoverflow.com/questions/32343677
复制相似问题