Using ngTagsInput in my project for tagging has posed a problem. After implementing the loadTags
function to fetch data from an API and changing the structure to {text : sometag}
, I encountered an issue where the autocomplete tag feature stopped working. I followed a tutorial at but still faced this issue.
Struggling with LoadTags Data Retrieval from API
$scope.loadTags = function(query) {
var url = "http://192.168.0.253:81/agnes/ruang-vemale/api/v1/category/get/3c8dd5e26e7e653c9823728f90fcbadf39c2651e/";
data = {
username: "newshubid",
data: {
orderby: {
field: "label",
type: "DESC"
}
}
};
args = {
"data": JSON.stringify(data)
};
param = $.param(args);
HttpService("POST", url, param, function(response) {
res = angular.fromJson(response.data);
angular.forEach(res, function(item) {
$scope.get_cat = {
text: item.label
};
return $scope.get_cat;
});
});
};
HTML Implementation
<tags-input ng-model="tag" class="bootstrap"
replace-spaces-with-dashes="false"
on-tag-added="AttachTag($tag)"
on-tag-removed="RemovedTag($tag)">
<auto-complete source="loadTags($query)"></auto-complete>
</tags-input>
If you have any insights on how to fix this issue or spot where I might have made a mistake, please share your thoughts. Thank you!