-1
我們需要在收件箱中實現類型提前功能,但是當我們從$ http得到響應get無效JSON,所以我無法做到那。
以下方法,我使用視圖級
uib-typeahead="name for name in collections ($viewValue)"
角:
$scope.collections = function(val) {
return $http.get('/Documents/DocumentsList/', {
params : {
stk : val
}
}).then(
function(response) {
if (response.data.suggestions) {
$("[uib-typeahead-popup].dropdown-menu").css('display','block');
return response.data.suggestions
.map(function(item) {
return item.term;
});
};
});
};
JSON響應:
{} && {
"name": "John",
"age": 31,
"city": "New York"
}
如何修改無效JSON到瓦利d JSON,然後傳遞有效的響應。
你爲什麼不解決實際的端點響應所以它是有效的JSON? – Phil
在您的JSON響應中沒有看到「建議」。你如何期望它能夠工作? – Phil
@菲爾:是的,你是對的。提供的json不是actula響應JSON唯一的示例格式 – CodeMan