Так что мне удалось запутать свой путь и не знакомство с машинописным шрифтом и безмятежным шаблоном. Я добавил весь автозаполнение вызова в конструкторе файла xxxxxDialog.ts и, похоже, работает хорошо.
constructor() {
super();
$('[name=EmpNum]').autocomplete({
minLength: 6,
autoFocus: true,
source: function (request, response) {
$.ajax({
url: "/services/adlookup/autocompleteuserlookup",
type: "POST",
dataType: "json",
data: { term: request.term },
success: function (data) {
response($.map(data, function (item) {//data needs to be array of objects
return { label: item.LastName + ", " + item.FirstName + " (" + item.Descriptions + ")", value: item.EmpNum + "|" + item.UserName + "|" + item.LastName + "|" + item.FirstName + "|" + item.EmailAddress + "|" + item.WorkPhone };//item is each item in array item.LastName
}))
}
})
},
focus: function() {
$(".ui-helper-hidden-accessible").hide();
event.preventDefault();
return false;
}
})
.on('autocompleteselect', function (e, ui) { //fill in data after it had been selected
var t = $(this),
label = (e.type == 'autocompleteresponse' ? ui.content[0].label : ui.item.label),
value = (e.type == 'autocompleteresponse' ? ui.content[0].value : ui.item.value);
var adprop = value.split("|");
return false;
});
}//end constructor
Хороший, я бы предпочел обернуть его в простой виджет. В руководстве есть образец. –