Why ngModel
is creating blank element in HTML - select - option? How can I get rid of this?
First code.
<div style="text-align: center;">
<label for="sel1">Select list (select one):</label>
<select class="form-control" id="sel1" style="height: 3rem; width: max-content; margin-left: 33.5rem;" (change)="getSelectedUserAccess()">
<option>suman</option>
<option selected>rony</option>
<option>alex</option>
</select>
</div>
Screenshot:
Second code [wrong]
<div style="text-align: center;">
<p>Select User : </p>
<select [(ngModel)]="currentSelectedUser" class="form-control" id="userSelect1"
style="height: 3rem; width: max-content; margin-left: 33.5rem;" (change)="getSelectedUserAccess()">
<option>suman</option>
<option selected>rony</option>
<option>alex</option>
</select>
</div>
screnshot :