gpt4 book ai didi

javascript - 如何使用ng-disable禁用angular js中的下拉列表项

转载 作者:行者123 更新时间:2023-11-28 03:54:24 24 4
gpt4 key购买 nike

这是我的 html 文件。这是我的下拉列表,有两个列表项密码重置和发送激活电子邮件我想禁用重置密码

        <div class="active-send-select" pull-left btn-group title="{{::'title.active.filter' | translate}}">
<button class="btn btn-large dropdown-toggle" data-toggle="dropdown" ng-disabled="!actionButtonStatus.SENT">
<i class="fa fa-envelope fa-lg"></i>
<span class="action-button-text">{{::'label.button.send' | translate}}</span>
<i class="icon-chevron-down pull-right" style="margin-top:-20px;"></i>
</button>
<ul class="dropdown-menu filter-state">
<li ng-class="abc"><a href="" ng-click="sendActivationNotification()"><span ng-class="{resettest: userstatus == 'Complete'}">{{::'label.dropdown.sendActivation' | translate}}</span></a></li>
<li class="test-dropdown">
<a href="" ng-click="onSendPasswordReset()"><span ng-class="{resettest: userstatus == 'Notified' || 'Added'}">{{::'label.dropdown.resetPassword' | translate}}</span></a>
</li>
</ul>
</div> i did this wid ng-class a su told now its showing gray color and but still m able to click on the password reset list item and it is redirecting to password reset page.


CSS code

.resettest{
color: darkgray;
cursor: not-allowed;
}

最佳答案

在你的 Controller 中:

isSelectDisabled() {
if (this.currentState === 'not ready') {
return true;
}
return false;
}

然后在你的模板中:

<li ng-disabled="vm.isSelectDisabled()"></li>

这假设您使用 vm ofc。

关于javascript - 如何使用ng-disable禁用angular js中的下拉列表项,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38742289/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com