用功能的UI可选选择



我正在尝试使用UI-Disable-Choice中的函数在UI序列中禁用选项。调用功能似乎不起作用。关于我做错了什么的想法?

ui-select

<ui-select 
            id="affSel--{{seat.sli_no}}"
            class="affSel"
            perf-no ="{{seat.perf_no}}"
            sli-no="{{seat.sli_no}}"
            ng-required="true"
            theme="bootstrap"
            on-select="changedAffiliate(mySeat.seat.sli_no, cartPerf.perf_no, seat.sli_no,seat)">
    <ui-select-match placeholder="-- Select person --">{{$select.selected.fname + ' ' + $select.selected.lname}}</ui-select-match>
    <ui-select-choices repeat="affiliate in affiliates | seatAffTypeFilter:seat.seatAff" 
                        ui-disable-choice="checkDisable(affiliate.customer_no,cartPerf.perf_no, seat.sli_no)">
        <div ng-bind-html="affiliate.fname + ' ' + affiliate.lname"></div>
        <small ng-show="affiliate.disabled">{{AffSelected}}</small>
        <small ng-show="affiliate.validation_pass_age == 'N'">{{invalidAffLbl}}</small>
    </ui-select-choices>
</ui-select>  

功能

$scope.checkDisable = function (customer_no, cur_perf_no, cur_sli_no) {
    $.each($scope.selectedAff, function (i) {
        if (this.customer_no == customer_no && this.perfNo == cur_perf_no && this.sli_no != cur_sli_no) {
            return true;
        } else {
            return false;
        }
    })
}

尝试

$scope.checkDisable = function (customer_no, cur_perf_no, cur_sli_no) {
    return false; //true;
}

如果这不起作用,则意味着不支持函数类型,但是如果起作用,则您有代码问题...

主要是您没有捕获$.each功能的结果,从上下文看来,您需要_.find而不是$.each

相关内容

  • 没有找到相关文章

最新更新