0
我有以下checkbox
我筛选,但是当我删除过滤器的checkboxes
都将丢失。我理解为什么 - 但Angular不会让我将检查值附加到我的ng-model
,因为它是只读。类型错误:无法分配给只读属性“检查”复选框
HTML:
<div class="modal-content">
<strong>ENTITIES</strong>
<div>
<div>
<input type="text" placeholder="Search" ng-model="simpleFilter">
<button type="button" ng-click="showModal=false">Ok</button>
</div>
</div>
<br/>
<div ng-repeat="entity in entityArray | filter:simpleFilter">
<label>
<input style="display: inline-block;
margin-top: 5px;"
type="checkbox" ng-model="entity.checked"
ng-change="getEntityFromModal(entity, entity.checked)" />
<a>{{entity}}</a>
</label>
</div>
</div>
我想给entity.checked
值传递给函数,我甚至不知道这是否是评估是否选中或falsey如果不truthy,但在此之前发生的错误,它根本不会让我附加checked
到entity
。
plunker https://plnkr.co/edit/2ptIAdOyaIw8mGqpU7Cp?p=preview - 打开控制台,并尝试检查一个盒子。
感谢您的输入,我在工作陷入了困境,此刻别的东西,但肯定会在未来几天将返回到这一点。 – xeon48
对不起,我花了一点时间回到这个。非常好,谢谢! – xeon48