2017-10-06 1 views
0

Wenn ich Auswahl in Drop-Down-ng-Wechsel ändern nicht gefeuert wird Im Folgenden sind meine HTML und JavaScript-Codeng Wechsel funktioniert nicht in ui-select2

      <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(); 
} 

Antwort

1

Sie on-select statt verwenden sollten ng-change die eine Winkelrichtlinie ist

<ui-select ng-model="DemandLine.SupplierId" theme="select2" on-select="GetSupplierInfo()">