I have this small Problem. I made a select box and I would like to have, that in my select box the first element is always selected and that changes in this Option field are effective for angular. at the Moment I use a useless empty Default field and only after i select the real Option, the changes are effective.
<div class="form-group">
<label class="form-control-label" jhiTranslate="wisatApp.threat.impact" for="field_impact">Impact</label>
<select class="form-control" id="field_impact" name="impact" [(ngModel)]="threat.impact" >
<option [ngValue]="null"></option>
<option [ngValue]="impactOption.id === threat.impact?.id ? threat.impact : impactOption" *ngFor="let impactOption of impacts | threatImpactFilter:secObj.value.toString():imValue.value.toString() ; trackBy: trackImpactById">{{impactOption.id}}</option>
</select>
</div>
I tried to solve the Problem with the Keyword "selected" in my second Option and I delete the first Option but it does not work. Whatever the changes are not effective in angular
<div class="form-group">
<label class="form-control-label" jhiTranslate="wisatApp.threat.impact" for="field_impact">Impact</label>
<select class="form-control" id="field_impact" name="impact" [(ngModel)]="threat.impact" >
<option [ngValue]="impactOption.id === threat.impact?.id ? threat.impact : impactOption" *ngFor="let impactOption of impacts | threatImpactFilter:secObj.value.toString():imValue.value.toString() ; trackBy: trackImpactById" selected >{{impactOption.id}}</option>
</select>
</div>
thank you much!