我不知道为什么,但是当我尝试设置$ scope变量在自动完成内部时,没有任何反应,$ scope变量未定义,($ scope.shipperdescripcion和$ scope.shipperlocation)但我需要知道如何让它发挥作用,thx
$(".shipper").autocomplete({
minLength: 3,
source: "controllers/search.php?catalogo=plantas",
select: function(event, ui, $scope){
$(this).val(ui.item.value).change();
$scope.shipperdescripcion = ui.item.id;
$scope.shipperlocation = ui.item.desc;
return false;
},
change: function (event, ui, $scope) {
if (ui.item == null) {
$scope.shipperdescripcion = '';
$scope.shipperlocation = '';
}
}
})
.data( "ui-autocomplete" )._renderItem = function( ul, item ) {
return $( "<li>" )
.data( "item.autocomplete", item)
.append( "<a><b>" + item.value + "</b><br>" + item.desc + "</a>" )
.appendTo( ul );
};