title: How to set an option as selected based on value in angular from component/html
body: <p>I have a select menu of a form which send data to sql DB and fetch back when it is called for editing the same value to be shown in select menu option as selected. Please have a look at my code.</p>
  
  <pre><code>&lt;label&gt;State&lt;/label&gt;
  &lt;select class="form-control" [(ngModel)] = "selectedState"  id="statelist" name="statelist" #statelist = "ngModel"  [disabled]="selectedCountry == null || selectedCountry == 0" required ngmodel&gt;
     &lt;option&gt;Select a State&lt;/option&gt;
     &lt;option *ngFor="let item of stateListSorted" [ngValue] = "item.name" [selected] = "stateOptions"&gt;{{item.name}}&lt;/option&gt;
  &lt;/select&gt;
  </code></pre>
  
  <p><strong>Component</strong></p>
  
  <pre><code>onEditCustomer(customerEdit: Customer): void{
      this.addFormStatus = true;
      this.addBtnStatus = false;
      this.customerEditCall = true;
      this.selectedCustomerEdit = customerEdit;
      this.companyName = this.selectedCustomerEdit.name;
      const country =  this.selectedCustomerEdit.country;
      this.stateOptions = this.selectedCustomerEdit.state;
    }
  </code></pre>