0

I have an array, that consists a list of json objects as items. I am using this array as an options list for two select controls, here I want to hide first select control selected items in second select control options list.

Is it possible to do?

1
  • can you give us an output example Commented Feb 25, 2018 at 6:34

1 Answer 1

1

I don't know why are you looking for a pipe/filter solution when it can be done so easily without pipe? I may not be knowing entire scenario of yours but what you have written according to that a simple solution would be,

<select class="form-control" [(ngModel)]="selectedCity">
     <option *ngFor="let ct of cities" [value]="ct.id">{{ct.name}}  
</select>



// look at [disabled]="selectedCity==ct.id"

 <select class="form-control" [(ngModel)]="selectedOtherCity">
     <option [disabled]="selectedCity==ct.id" *ngFor="let ct of cities" [value]="ct.id">{{ct.name}}  
</select>

detailed code could be found here : https://plnkr.co/edit/gkvFqtyddLVEsFOE07Ls?p=preview

Sign up to request clarification or add additional context in comments.

2 Comments

Thank you actually I don't know this [disabled] option in select
Welcome! Have a great time with Angular.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.