I have searched far and wide. What I got from other answers is that I need to use [selected]
if I want to select a particular option.
It does not seem to be working. Why? Here is what I have:
<ngx-datatable-column name="status" prop="operationStatus" [flexGrow]="1">
<ng-template let-value="value2" let-row="row" let-rowIndex="rowIndex" gx-datatable-cell-template>
<select class="geraeteStatus" [(ngModel)]="selectableGerateStatus">
<option *ngFor="let e of selectableGerateStatus" [ngValue]="e"
[selected]="e.id === value2">
{{e.id}}
</option>
</select>
</ng-template>
</ngx-datatable-column>
I am sure that the value of e.id
equals that of value2
at least once per iteration. However it just does not work.
Actually I can put whatever I wish (e.id === 2, or even 'true') into [selected]
it does not have any effect.
I have no idea what I am missing. Any answer is highly appreciated.