我有以下兩個選擇框;自定義過濾器從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