I read the docs and if you want to prepoulate with some tags, you can use an ul element:
<ul id="myULTags">
<li>Tag1</li>
<li>Tag2</li>
</ul>
But the thing is that i use a custom autocomplete source like this:
$("#myULTags").tagit({
allowSpaces: true, autocomplete: {
delay: 500, minLength: 1, source: function (request, response) {
$.ajax({
url: '/controller/method/',
type: 'GET',
dataType: 'json',
async: false,
cache: false,
data: { Campo: request.term },
success: function (dados) {
let data = JSON.parse(JSON.stringify(dados));
currentlyValidTags = data;
response($.map(data, function (item) {
return {
label: item,
value: item
};
}));
},
failure: function (response) {
currentlyValidTags = [];
return [];
},
error: function (response) {
currentlyValidTags = [];
return [];
}
});
}
},
beforeTagAdded: function (event, ui) {
if ($.inArray(ui.tagLabel, currentlyValidTags) == -1) {
return false;
}
}
});
And as the result, my prepopulated tags get overridden. Is there a way to prepopulate my tagit component AND use the custom autocomplete source?