selected not working in option in angular 8

Viewed 70

I am writing the following code:

            <select
                formControlName="abc"
                type="text"
                class="form-control"
                id="abc"
                aria-describedby="abcHelp"
                [(ngModel)]="optionValue"
            >
                <option value="" disabled selected>
                    Select Yes/No
                </option>
                <option value="true">Yes</option>
                <option value="false">No</option>
            </select>

It works fine without [(ngModel)]="optionValue" but I need to make it work with NgModel so that I can access values of options.

0 Answers
Related