我有以下两个选择框;自定义过滤器从AngularJS 1.x中的另一个选择框中删除选定的选项
<select name="primary_communication" id="primary_communication" class="form-control"
data-ng-model="addCareAdminController.careAdminModel.primaryCommunication"
data-ng-options="type.code as type.description for type in addCareAdminController.communicationTypes">
<option value="">Select Primary Communication</option>
</select>
<select name="secondary_communication" id="secondary_communication" class="form-control"
data-ng-model="addCareAdminController.careAdminModel.secondaryCommunication"
data-ng-options="type.code as type.description for type in addCareAdminController.communicationTypes">
<option value="">Select Secondary Communication</option>
</select>
它采用与value相同的对象数组;
self.communicationTypes = [
{code: "CMPH", groupCode: "COMM-METH", description: "Mobile Phone"}
{code: "CWPH", groupCode: "COMM-METH", description: "Work Phone"}
{code: "CPNO", groupCode: "COMM-METH", description: "Pager Number"}
{code: "CEMA", groupCode: "COMM-METH", description: "Email"}
]
我需要一个自定义过滤器执行以下操作。如果我在主通信选择框中选择任何选项说移动电话,我希望从辅助通信选择框中删除该选项。反之亦然。
我试过了这个link给出的解决方案,但它不适合我。此外,他们还没有给出自定义过滤器解决方案。请帮助我。
从主要沟通到辅助工作正常,但相反是行不通的。 – karthi
@karthi再次查看演示 –
完美工作,谢谢@sachila。 – karthi