Angular select option shows blank when assigned from array

I want to show my strings array in select dropdown. I tried the normal way :

<form [formGroup]="emailForm" #form="ngForm" (ngSubmit)="sendEmail()" novalidate class="tooltip-center-bottom">
  <div class="form-group">
    <select id="emailTem" class="form-control" formControlName="emailTem" [(ngModel)]="emailTem">
      <option value="" disabled selected>Select Email Template</option>
      <option *ngFor="let obj of emailArray" [ngValue]="obj">{{obj}}</option>    
    </select>
    <div *ngIf="statusForm.get('status').errors?.required && form.submitted" class="invalid-tooltip">Status is required!</div>
  </div>
  <button class="btn btn-primary status-button" type="submit">Submit</button>
</form>

The array i have assigned :

emailArray: string[] = [
    'Call Not Connected',
    'Refund'
];

it was working before normal. But now it’s not showing blank

dropdown

if i try with normal by setting values directly like this : <option value="New" ng-reflect-value="New">New</option> it works properly

Even stackbliz not working

23 thoughts on “Angular select option shows blank when assigned from array”

Leave a Comment