title: Change dropdown selected value on click in angularjs
body: <p>I have created a dropdown using angularjs directive. Following is the template I have used</p>
  
  <pre><code>&lt;select ng-model="selected" ui-select2="{allowClear: true, placeholder: placeholder}"&gt;' +
              '&lt;option value=""&gt;&lt;/option&gt;' +
                '&lt;optgroup ng-repeat="group in Groups" label="{{group.name}}"&gt;' +
                  '&lt;option ng-repeat="value in values" value="{{value.code}}" &gt;{{value.name}}&lt;/option&gt;' +
                '&lt;/optgroup&gt;' +
            '&lt;/select&gt;
  </code></pre>
  
  <p>Now, I have a table which has same dropdown values in one of the columns. When a table row is clicked I need to get the value and select the respective value in the dropdown automatically. I was able to fetch values from the row but not sure how to select the clicked option in the dropdown.
  I have searched around for suggestions but got nothing so far. Please suggest. I have started learning angularjs last week only so pardon me if I am missing something obvious here.</p>