0

I am trying to get my field to work properly on angular 6 reactive form,

The problem is that the first option (the selected disabled option) is not showing as first on initiating (it shows the one from option from the *ngFor's) , I think that the main issue caused from the multiple select option attribute, even thou it not initiating as a multiple select option but as a simple select option (It changes by different input to multiple select option)

here's my code:

  <div class="form-group">
    <label for="cakes" class="sr-only">Select from existing</label>
    <select  formControlName="cakes" name="cakes" [multiple]="form.value.amount > 1" class="form-control">
      <option  value="null" disabled selected>Select {{form.value.amount}}</option>
      <option *ngFor="let cake of cakes" [value]="cake.id">{{cake.name}}</option>
    </select>
  </div>
1

1 Answer 1

1

please set default value of first select option as a "".

like below

<option value="">--- Select ---</option>
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.