2016-01-02 69 views

回答

1

你可以用你的UI選元素的NG-初始化指令搶UI選擇控制器:

<div ng-controller="MyCtrl"> 
    <ui-select ng-init="$parent.myUiSelect = $select" ...> 
    ... 
    </ui-select> 
</div> 

然後在你的控制器中:

app.controller('MyCtrl', ['$scope', function($scope) { 
    $scope.myUiSelect.search = "new value"; 
}]); 
0

請嘗試如下。

HTML:

<ui-select id="mySelect"> 

JS:

angular.element('#mySelect').controller('uiSelect').search = "<new-search-string>"; 
相關問題