我在角度项目中使用angucomplete-alt:
<angucomplete-alt id="ex2"
placeholder="ID Boitier"
pause="300"
selected-object="selectedDeviceId"
local-data="getAllData"
title-field="id,name"
search-fields="name"
minlength="3"
input-class="form-control form-control-small"
match-class="highlight" />
selectedDeviceId
$scope.selectedDeviceId = function(selected) {
if (selected) {
var item=selected.title.replace(" ","-");
// window.alert('You have selected ' + item);
$scope.id=item.substring(0,item.indexOf("-"));
//alert(id);
//$scope.tr=item;
$scope.PageNumber=1;
dashboard.getTraccarData($scope.id,$scope.PageNumber,dashboard.RecordNummber);
return item;
} else {
console.log('cleared');
}
};
它的效果很好!!但是i4m试图做的是,而不是用名字显示id,我想在这个领域用' - '分隔它们。如何实现它。