当我在下拉列表中更改选择时,不会触发更改 以下是我的html和js代码
<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();
}
答案 0 :(得分:1)
您应该使用 on-select
而不是 ng-change
这是一个角度指令
<ui-select ng-model="DemandLine.SupplierId" theme="select2" on-select="GetSupplierInfo()">