title: AngularJS selecting multiple options
body: <p>So, What I'm trying to do is fairly simple with vanilla JS, but I'm using AngularJS and I would like to know how to do it the best way within the framework. I want to update the selected options in a multiple select box. I do not want to add or remove any of the options. Here is what my HTML looks like:</p>
  
  <pre><code>&lt;select multiple&gt;
      &lt;option value="1"&gt;Blue&lt;/option&gt;
      &lt;option value="2"&gt;Green&lt;/option&gt;
      &lt;option value="3"&gt;Yellow&lt;/option&gt;
      &lt;option value="4"&gt;Red&lt;/option&gt;
  &lt;/select&gt;
  </code></pre>
  
  <p>Using the following array, I'd like to programmatically select/deselect options from this list:</p>
  
  <pre><code>[{id:1, name:"Blue"},{id:4, name:"Red"}]
  </code></pre>
  
  <p>When I set this array in the scope, I want the select box to deselect anything that is not Blue or Red and select Blue and Red. The standard response that I've seen on the Google Groups is to use ng-repeat. However, I can't recreate the list every time because the list of selected values is incomplete. As far as I can tell, AngularJS has no mechanism for this, and I'm at a loss as to how I would do this without resorting to using jQuery.</p>