【问题标题】:on-select function call is very slow in ui-select angularjsui-select angularjs中的on-select函数调用非常慢
【发布时间】:2019-12-04 05:23:16
【问题描述】:
<ui-select
    ng-model="ruleSelected"
    theme="bootstrap"
    on-select="selectedItem($item)">
    <ui-select-match>{{$select.selected.name}}</ui-select-match>
    <ui-select-choices repeat="o.name as o in rules | propsFilter: {name: $select.search}" position="down">
        <div ng-bind-html="o.name | highlight: $select.search"></div>
    </ui-select-choices>
</ui-select>
$scope.selectedItem = function(item) {
    $scope.ruleSelected = item;
    $scope.selected = item;
};

在下拉列表中选择值后设置$scope.ruleSelected 需要很长时间。有人可以帮帮我吗?

提前致谢

【问题讨论】:

    标签: html angularjs dropdown ui-select


    【解决方案1】:
    You do not have to pass a selected value into the ng-model.
    when you select a value from the drop-down then ng-model bind that value.
    you just have to pass as default 
    
    js code:
    $scope.ruleSelected = '';
    $scope.selectedItem = function(item) {
        $scope.selected = item;
    };
    
    Reference link:
    http://embed.plnkr.co/lWUBC7/
    

    【讨论】:

      猜你喜欢
      • 2015-10-03
      • 1970-01-01
      • 2012-03-11
      • 1970-01-01
      • 2013-01-30
      • 2011-10-25
      • 2013-04-10
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多