1
如何从我的代码中设置搜索字符串(即$select.search
)?当然,选择过滤器应根据新的搜索字符串应用。ui-select:如何以编程方式设置搜索字符串?
如何从我的代码中设置搜索字符串(即$select.search
)?当然,选择过滤器应根据新的搜索字符串应用。ui-select:如何以编程方式设置搜索字符串?
你可以用你的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";
}]);
请尝试如下。
HTML:
<ui-select id="mySelect">
JS:
angular.element('#mySelect').controller('uiSelect').search = "<new-search-string>";