0

I have built these two dropDown Lists:
enter image description here

Using this html code:

<div class="form-group">
  <select  name="dropDownList1" class="form-control form-control-sm">
  <option *ngFor="let s of list_of_Values;"  id="field_status" name="field_status"   >{{s}}</option>
</select>
<select  name="dropDownList2" class="form-control form-control-sm">
  <option *ngFor="let s of list_of_Values;"  id="field_status" name="field_status"   >{{s}}</option>
</select>
</div>

And this typescript code:

list_of_Values:string[]=['value1','value2','value3','value4']
  list_of_Chosen_Values:string[]=['chosenValueOfList1','chosenValueOfList2']

What I want to do is use

ngModel

inside the option tag:

  <option *ngFor="let s of list_of_Values;"  id="field_status" name="field_status"   >{{s}}</option>

To bind the values of :

  list_of_Chosen_Values:string[]=['chosenValueOfList1','chosenValueOfList2']

To the chosen values by the user in the two lists.
Is this even doable?

AG_HIHI
  • 1,705
  • 5
  • 27
  • 69

0 Answers0