2016-01-02 104 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>"; 
相关问题