title: Selected specific option in dropdown based on data retrieved from database(mysql) with ng-option
body: <p>I need help with automatic selecting the option in dropdown list based on data retrieved from database. It is for editing purpose (when you editing, the data will be retrieved automatically so that you can edit). Currently, I'm able to retrieve data from database and put it in dropdown list. Btw, I'm using ng-option and the model I'm using is MVC.</p>
  
  <pre><code>    &lt;div class="col-sm-4 col-md-4"&gt;
          &lt;div class="form-group" data-ng-init="companies = &lt;?php echo htmlspecialchars(json_encode($this-&gt;companyList)); ?&gt;"&gt;
              &lt;label for="companyname"&gt;Company Name&lt;/label&gt;
              &lt;select class="form-control"  data-ng-options="c.id as c.company_name for c in companies track by c.id" id="companyname" name="companyname" data-ng-model="filter.company"&gt;
              &lt;/select&gt;
          &lt;/div&gt;
      &lt;/div&gt;
  </code></pre>
  
  <p>Initially, the dropdown list will be like this</p>
  
  <p><img src="https://i.stack.imgur.com/l6yab.png" alt="Initially, the dropdown list will be like this"></p>
  
  <p>The dropdown I want</p>
  
  <p><img src="https://i.stack.imgur.com/T7eaq.png" alt="The dropdown I want"></p>
  
  <p>Your kind assistance is much appreciated please. Thank You.</p>