0

I have an issue with setting values of combobox from the component. values for comboboxes are loaded in levelCombined[j][i]['result']

                <tr *ngFor="let x of levelCombined, let j=index">
                <td *ngFor="let y of x, let i=index">
                    <select class="form-control" id="comboBoxLevelSelction"
                            name="levelSelection"
                            (change)="onLevelSelect($event,j,i)">
                        <option disabled selected value> - select an option -</option>
                        <option *ngFor="let ln of levelNames" [ngValue]="levelCombined[j][i]['result']">{{levelCombined[j][i]['result']}}</option>
                    </select>
                </td>
            </tr>

Currently all comboboxes are set with default option. I think that I am not using ngValue properly.

1

1 Answer 1

1

use [(ngModel)] to bind the default option with value of the component.

Sign up to request clarification or add additional context in comments.

1 Comment

you are right I, I used code. <option selected [(ngModel)]="levelCombined[j][i]" ngDefaultControl>{{levelCombined[j][i]['level']}}</option> code. and it works. 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.