We need to implement type ahead functionality in inbox box ,but when we got response from $http get is invalid JSON so that i cant able do that.
below method i am using for view level
uib-typeahead="name for name in collections ($viewValue)"
Angular:
$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 Response:
{} && {
"name": "John",
"age": 31,
"city": "New York"
}
How to modify the invalid JSON to valid JSON and pass the valid response in then.
It would be better to fix the problem at the source but, if you can't do that, implement your own response transformer