Adarsh saraogi
Adarsh saraogi

Reputation: 39

How To change Drop Down Option Dynamically

I am Creating a Drop Down Button According to the Rank basis and option should be popped of when the existing Drop down has the same value (Rank) and option should not be repeated. Example: enter image description here

enter image description here

If the rank number is range from 1, 2, 3, 4, 5

And if i select 1 from the drop down the number 1 should not be displayed on the drop down and if i remove 1 from the list it should back to the drop-down option

Note: i am using bootstrap and angular6.

Upvotes: 1

Views: 291

Answers (2)

Hasnain Ali Sohrani
Hasnain Ali Sohrani

Reputation: 415

<select class="my-style"  (change)="selectedOption($event)">
 <option selected disabled> Select option</option>
 <option *ngFor="let option of list; let i = index" >{{option.name}}</option>
</select>

Upvotes: 1

Pavittar Singh
Pavittar Singh

Reputation: 55

There are two types form in angular. One is template driven and other is reactive form. In template driven you need to change the ng-model value options and in reactive form you can change the options using FormControl name

Upvotes: 0

Related Questions