Angularjs ng更改在ui-select2中不起作用
当我在下拉列表中更改选择时,不触发更改 下面是我的html和js代码Angularjs ng更改在ui-select2中不起作用,angularjs,ui-select2,Angularjs,Ui Select2,当我在下拉列表中更改选择时,不触发更改 下面是我的html和js代码 <ui-select ng-model="DemandLine.SupplierId" theme="select2" ng-change="GetSupplierInfo()"> <ui-select-match allow-clear="true" placeholder="Select
<ui-select ng-model="DemandLine.SupplierId" theme="select2" ng-change="GetSupplierInfo()">
<ui-select-match allow-clear="true" placeholder="Select or search supplier in the list...">{{$select.selected.SupplierName}}</ui-select-match>
<ui-select-choices repeat="supplier.Id as supplier in (Suppliers | filter: $select.search)">
<span ng-bind-html="supplier.SupplierName | highlight: $select.search"></span>
</ui-select-choices>
</ui-select>
$scope.GetSupplierInfo = function () {
var _supplier = _.find($scope.Suppliers, function (data) { return (data.Id == $scope.DemandLine.SupplierId) });
if (_supplier != undefined && _supplier != null && _supplier.Active == true) {
$scope.DemandLine.SupplierId = _supplier.Id;
$scope.DemandLine.Supplier = _supplier.SupplierName;
}
else {
$scope.DemandLine.SupplierId = null;
$scope.DemandLine.Supplier = null;
}
$scope.setStatus();
}
{{$select.selected.SupplierName}
$scope.GetSupplierInfo=函数(){
var_supplier=u.find($scope.Suppliers,函数(数据){return(data.Id==$scope.DemandLine.SupplierId)});
如果(_supplier!=未定义&&&u supplier!=空&&u supplier.Active==真){
$scope.DemandLine.SupplierId=\u supplier.Id;
$scope.DemandLine.Supplier=\u Supplier.SupplierName;
}
否则{
$scope.DemandLine.SupplierId=null;
$scope.DemandLine.Supplier=null;
}
$scope.setStatus();
}
您应该在选择时使用,而不是ng change
,后者是一个角度指令
<ui-select ng-model="DemandLine.SupplierId" theme="select2" on-select="GetSupplierInfo()">