title: In Angular, given an array of objects and a single input, how do bind the input so that it represents a given property of all the objects?
body: <p>Given an array of objects (such as would represent a selection of items, for example), and an input, how do you go about binding the input value so that it represents a given property of all the objects?</p>
  
  <p>The input should display state in the manner:</p>
  
  <ul>
  <li>if all values for this property are the same on all objects, display that value</li>
  <li>if at least one value is not the same, set the input.value to 'multiple'</li>
  <li>if all values are undefined, set the input.value to 'none'</li>
  </ul>
  
  <p>I have the function that aggregates the values for a given property exposed on the scope:</p>
  
  <pre><code>// Return value (if all values are equal) or undefined (if not)
  scope.getSelection('property')
  </code></pre>
  
  <p>I also have the function that sets a value on all the objects:</p>
  
  <pre><code>scope.setSelection('property', value)
  </code></pre>
  
  <p>I can't find a combination ng-value, ng-model and ng-change that allows me to both get from .getSelection() and set to .setSelection() automatically, so I'm assuming I have to write a new directive.</p>
  
  <p>What's the idiomatic way to solve this problem?</p>