0

I would like to select default value ( 484 which is Mexico), but the first item get selected.

In the text, I print all value, and they are all OK (country.id === tournament.venue.country_id condition is working)

Here is my code, I am not using reactive forms:

<select class="form-control select-lg" id="country_id" name="country_id" [(ngModel)]="tournament.venue.country_id">
    <option *ngFor="let country of countries"
        [selected]="country.id === tournament.venue.country_id"
        [ngValue]="tournament.venue.country_id">
        {{ country.name }} {{ country.id }} {{ country.id === tournament.venue.country_id }}
    </option>
</select>

What am I doing wrong ?

1 Answer 1

3

ngValue should be country id

 [ngValue]="country.id">
Sign up to request clarification or add additional context in comments.

1 Comment

ooooo ! Thanks !

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.