I have a weird issue using a . To fill the I have a JSON like this :
values: [{'id' : 'male', 'label' : 'Homme'}, {'id': 'female', 'label' : 'Femme'}]
My HTML looks like this :
<div class="col-md-2" *ngIf="type === 'select'">
<mat-form-field>
<select matNativeControl>
<option *ngFor="let options of values"
[value]="options.id"
[selected]="options.id == selectedValue">
{{options.label}}
</option>
</select>
<mat-hint align="end">{{ label }}</mat-hint>
</mat-form-field>
</div>
If selectedValue
is equal to female
there is no issue. But if it's equal to male
there is no selected option and I can't find why
Any help ?
Thanks