title: Angular 5 formGroup formControlName issue with select options
body: <p><strong>Update</strong></p>
  
  <p>We are using Angular5 and we have a form that is constructed using FormGroup and then binded using formgroup and formControlName. </p>
  
  <p>On initial load everything is populating correctly in all input fields. After closing the modal and then clicking on another record populates all fields with the correct userFrm value except the Salutation and AwardStatus Dropbox. If you click back on the first record then the values are correct. This has been causing issues for us. I'm pretty sure it is the [Selected[ property is not updating.</p>
  
  <p><strong>user.component.ts snippet</strong> </p>
  
  <pre><code>ngOnInit(): void {
          this.indLoading = true;
          this.loadSalutationField();
          this.loadResearchField();
          this.loadTrustField();
          this.loadRegionField();
          this.loadAwardStatusField();
          this.loadRoleField();
          this.loadUsers();
          this.indLoading = false;
          this.createForm();
      }
  
      createForm() {
          this.userFrm = new FormGroup({
              UserKey: new FormControl(''),
              SiID: new FormControl('', Validators.required),
              OrcidID: new FormControl(''),
              Salutation: new FormControl({}),
              FirstName: new FormControl('', Validators.required),
              Surname: new FormControl('', Validators.required),
              CurrentPost: new FormControl(''),
              Department: new FormControl(''),
              Institution: new FormControl(''),
              Region: new FormControl({}),
              PrimaryResearchField: new FormControl({}),
              SecondaryResearchField: new FormControl({}),
              NHSTrust: new FormControl({}),
              Street: new FormControl(''),
              City: new FormControl(''),
              County: new FormControl(''),
              Postcode: new FormControl(''),
              Telephone: new FormControl(''),
              Mobile: new FormControl(''),
              Email: new FormControl('', Validators.required),
              Fax: new FormControl(''),
              SecondaryEmail: new FormControl(''),
              ProfessionalBackground: new FormControl(''),
              ApprovalStatus: new FormControl(''),
              Biography: new FormControl(''),
              NIHRAccount: new FormControl(''),
              IsCurrent: new FormControl(''),
              AwardStatusDate: new FormControl(''),
              CreatedDate: new FormControl(''),
              UpdatedDate: new FormControl(''),
              IsActive: new FormControl(''),
              Image: new FormControl({}),
              AwardStatus: new FormControl({}),
              Role: new FormControl({})
          });
      }
  
  updateUserForm() {
          this.userFrm.setValue({
              UserKey: this.user.UserKey,
              SiID: this.user.SiID,
              OrcidID: this.user.OrcidID,
              Salutation: this.user.Salutation,
              FirstName: this.user.FirstName,
              Surname: this.user.Surname,
              CurrentPost: this.user.CurrentPost,
              Department: this.user.Department,
              Institution: this.user.Institution,
              Region: this.user.Region,
              PrimaryResearchField: this.user.PrimaryResearchField,
              SecondaryResearchField: this.user.SecondaryResearchField,
              NHSTrust: this.user.NHSTrust,
              Street: this.user.Street,
              City: this.user.City,
              County: this.user.County,
              Postcode: this.user.Postcode,
              Telephone: this.user.Telephone,
              Mobile: this.user.Mobile,
              Email: this.user.Email,
              Fax: this.user.Fax,
              SecondaryEmail: this.user.SecondaryEmail,
              ProfessionalBackground: this.user.ProfessionalBackground,
              ApprovalStatus: this.user.ApprovalStatus,
              Biography: this.user.Biography,
              NIHRAccount: this.user.NIHRAccount,
              IsCurrent: this.user.IsCurrent,
              AwardStatusDate: this.user.AwardStatusDate,
              CreatedDate: this.user.CreatedDate,
              UpdatedDate: this.user.UpdatedDate,
              IsActive: this.user.IsActive,
              Image: this.user.Image,
              AwardStatus: this.user.AwardStatus,
              Role: this.user.Role
          });
  
  editUser(userKey: number) {
          this.dbops = DBOperation.update;
          this.setControlsState(true);
          this.createForm();
          this.modalTitle = "Edit User";
          this.modalBtnTitle = "Update";
          this.user = this.users.filter(x =&gt; x.UserKey === userKey)[0];
          this.dangerousImage = "data:image/jpg;base64," + this.user.Image.ImageStream;
          this.trustedImage = this._sanitizer.bypassSecurityTrustUrl(this.dangerousImage);
          this.updateUserForm();
          this.editModal.open();
      }
  </code></pre>
  
  <p><strong>user.component.html</strong></p>
  
  <pre><code>&lt;bs-modal #editModal [keyboard]="false" [backdrop]="'static'"&gt;
      &lt;form [formGroup]="userFrm" (ngSubmit)="onSubmit()" novalidate&gt;
          &lt;!--&lt;pre&gt;{{userFrm.value | json}}&lt;/pre&gt;--&gt;
          &lt;bs-modal-header&gt;
              &lt;h4 class="modal-title"&gt;{{modalTitle}}&lt;/h4&gt;
          &lt;/bs-modal-header&gt;
          &lt;bs-modal-body&gt;
              &lt;div class="square"&gt;
                  &lt;img [src]="trustedImage" /&gt;
                  &lt;button (click)="updateUserPhoto(user.UserKey)"&gt;Upload Image&lt;/button&gt;
              &lt;/div&gt;
              &lt;br /&gt;
              &lt;div class="form-group" *ngIf="isAdmin"&gt;
                  &lt;span&gt;Role*&lt;/span&gt;
                  &lt;select class="form-group" formControlName="Role"&gt;
                      &lt;option *ngFor="let role of roles"
                              [value]="role"
                              [selected]="role.Description === userFrm.value.Role.Description"&gt;
                          {{role.Description}}
                      &lt;/option&gt;
                  &lt;/select&gt;
              &lt;/div&gt;
              &lt;div class="form-group" *ngIf="isAdmin"&gt;
                  &lt;span&gt;
                      Award Status*
                  &lt;/span&gt;
                  &lt;select class="form-group" formControlName="AwardStatus"&gt;
                      &lt;option *ngFor="let awardStatus of awardStatues"
                              [value]="awardStatus"
                              [selected]="awardStatus.Description == userFrm.value.AwardStatus.Description"&gt;
                          {{awardStatus.Description}}
                      &lt;/option&gt;
                  &lt;/select&gt;
              &lt;/div&gt;
              &lt;div class="form-group"&gt;
                  &lt;span&gt;SI Number*&lt;/span&gt;
                  &lt;input type="text" class="form-control" placeholder="Si Number" formControlName="SiID" /&gt;
              &lt;/div&gt;
              &lt;div class="form-group"&gt;
                  &lt;span&gt;Title*&lt;/span&gt;
                  &lt;select class="form-control" formControlName="Salutation"&gt;
                      &lt;option *ngFor="let salutationfield of salutationfields"
                              [value]="salutationfield"
                              [selected]="salutationfield.Description === userFrm.value.Salutation.Description"&gt;
                          {{salutationfield.Description}}
                      &lt;/option&gt;
                  &lt;/select&gt;
              &lt;/div&gt;
              &lt;div class="form-group"&gt;
                  &lt;span&gt;First name*&lt;/span&gt;
                  &lt;input type="text" class="form-control" placeholder="First name" formControlName="FirstName" /&gt;
              &lt;/div&gt;
              &lt;div class="form-group"&gt;
                  &lt;span&gt;Surname*&lt;/span&gt;
                  &lt;input type="text" class="form-control" placeholder="Surname" formControlName="Surname" /&gt;
              &lt;/div&gt;
              &lt;div class="form-group"&gt;
                  &lt;span&gt;Orchid ID*&lt;/span&gt;
                  &lt;input type="text" class="form-control" placeholder="OrcidID" formControlName="OrcidID" /&gt;
              &lt;/div&gt;
              &lt;div class="form-group"&gt;
                  &lt;span&gt;Telephone*&lt;/span&gt;
                  &lt;input type="text" class="form-control" placeholder="Telephone" formControlName="Telephone" /&gt;
              &lt;/div&gt;
              &lt;div class="form-group"&gt;
                  &lt;span&gt;Email*&lt;/span&gt;
                  &lt;input type="text" class="form-control" placeholder="Email" formControlName="Email" /&gt;
              &lt;/div&gt;
              &lt;div class="form-group"&gt;
                  &lt;span&gt;Current Post*&lt;/span&gt;
                  &lt;input type="text" class="form-control" placeholder="Current Post" formControlName="CurrentPost" /&gt;
              &lt;/div&gt;
              &lt;div class="form-group"&gt;
                  &lt;span&gt;Institution*&lt;/span&gt;
                  &lt;input type="text" class="form-control" placeholder="Institution" formControlName="Institution" /&gt;
              &lt;/div&gt;
              &lt;div class="form-group"&gt;
                  &lt;span&gt;Department*&lt;/span&gt;
                  &lt;input type="text" class="form-control" placeholder="Department" formControlName="Department" /&gt;
              &lt;/div&gt;
              &lt;div class="form-group"&gt;
                  &lt;span&gt;NHS Trust*&lt;/span&gt;
                  &lt;select formControlName="NHSTrust"&gt;
                      &lt;option *ngFor="let trustfield of trustfields"
                              [value]="trustfield"
                              [selected]="trustfield.Description === userFrm.value.NHSTrust.Description"&gt;
                          {{trustfield.Description}}
                      &lt;/option&gt;
                  &lt;/select&gt;
              &lt;/div&gt;
              &lt;div class="form-group"&gt;
                  &lt;span&gt;Region*&lt;/span&gt;&lt;br /&gt;
                  &lt;select formControlName="Region"&gt;
                      &lt;option *ngFor="let regionfield of regionfields"
                              [value]="regionfield"
                              [selected]="regionfield.Description === userFrm.value.Region.Description"&gt;
                          {{regionfield.Description}}
                      &lt;/option&gt;
                  &lt;/select&gt;
              &lt;/div&gt;
              &lt;div class="form-group"&gt;
                  &lt;span&gt;Primary Research Field*&lt;/span&gt;&lt;br /&gt;
                  &lt;select formControlName="PrimaryResearchField"&gt;
                      &lt;option *ngFor="let priResearchField of researchfields"
                              [value]="priResearchField"
                              [selected]="priResearchField.Description === userFrm.value.PrimaryResearchField.Description"&gt;
                          {{priResearchField.Description}}
                      &lt;/option&gt;
                  &lt;/select&gt;
              &lt;/div&gt;
              &lt;div class="form-group"&gt;
                  &lt;span&gt;Secondary Research Field*&lt;/span&gt;&lt;br /&gt;
                  &lt;select formControlName="SecondaryResearchField"&gt;
                      &lt;option *ngFor="let secResearchField of researchfields"
                              [value]="secResearchField"
                              [selected]="secResearchField.Description === userFrm.value.SecondaryResearchField.Description"&gt;
                          {{secResearchField.Description}}
                      &lt;/option&gt;
                  &lt;/select&gt;
              &lt;/div&gt;
              &lt;br /&gt;
              &lt;div class="form-group"&gt;
                  &lt;accordion&gt;
                      &lt;accordion-group heading="Biography"&gt;
                          &lt;input type="text" class="form-control" placeholder="Biography" formControlName="Biography" /&gt;
                      &lt;/accordion-group&gt;
                  &lt;/accordion&gt;
              &lt;/div&gt;
          &lt;/bs-modal-body&gt;
          &lt;bs-modal-footer&gt;
              &lt;div&gt;
                  &lt;a class="btn btn-default" (click)="editModal.close()"&gt;Cancel&lt;/a&gt;
                  &lt;button type="submit" [disabled]="userFrm.invalid" class="btn btn-primary"&gt;{{modalBtnTitle}}&lt;/button&gt;
              &lt;/div&gt;
          &lt;/bs-modal-footer&gt;
      &lt;/form&gt;
  &lt;/bs-modal&gt;
  </code></pre>
  
  <p>Any ideas on this would be greatly appreciated.</p>
  
  <p>Many thanks in advance</p>
  
  <p>Lewis</p>