gpt4 book ai didi

javascript - Angularjs checklist-model - 禁用未选中的框

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

嘿 Stackoverflow 的 super 英雄。我目前正在使用 angularjs 和 checklist-model 指令制作 list 。我试图弄清楚当达到 x 数量的选中框时如何禁用所有未选中的框。

我正在从 json 文件中获取数据,因此我的复选框位于 ng-repeat 中。

现在我禁用所有复选框。当达到检查的x个数时。不幸的是,用户应该能够更改所选择的内容。

<label ng-repeat="item in items | orderBy:item_position"> 
<h3>{{item.item_name}}</h3>
<p>{{item.item_position}}</p>
<!--checkbox -->
<input type="checkbox" ng-disabled="item.answers.length >= 12" checklist-model="item.answers" checklist-value="player">

最佳答案

你可以在你的 ng-disabled 中尝试一下:

ng-disabled="item.answers.length >= 12 && item.answers === 玩家"

但是,如果您发布了包含指令和一些示例数据的 jsfiddle,这将会很有用。

关于javascript - Angularjs checklist-model - 禁用未选中的框,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26215091/

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