title: Angularjs Multiple Select: Cannot read property 'length' of undefined
body: <p>I have tried many variations but nothing seem to work.</p>
  
  <p>I am getting the following error:</p>
  
  <pre><code>TypeError: Cannot read property 'length' of undefined
  at select.js:1560
  at m.$broadcast (angular.js:18487)
  at Object.ctrl.select (select.js:673)
  at fn (eval at compile (angular.js:15358), &lt;anonymous&gt;:4:453)
  at e (angular.js:26994)
  at b.$eval (angular.js:18161)
  at b.$apply (angular.js:18261)
  at HTMLDivElement.&lt;anonymous&gt; (angular.js:26999)
  at HTMLDivElement.dispatch (jquery-3.2.1.min.js:3)
  at HTMLDivElement.q.handle (jquery-3.2.1.min.js:3)
  </code></pre>
  
  <p>My code in the HTML part is:</p>
  
  <pre><code>&lt;label for="addRecipient" class="bold"&gt;Additional Recipients:&lt;/label&gt;
  &lt;ui-select multiple ng-model="addRecipient.selection" theme="bootstrap" title="Choose Recipients" class="multipleSelect"&gt;
  &lt;ui-select-match placeholder="Select Additional Recipients..."&gt;{{$item.name}}&lt;/ui-select-match&gt;
  &lt;ui-select-choices repeat="additional in addRecipients | filter:$select.search"&gt;
   {{additional.name}}
  &lt;/ui-select-choices&gt;
  &lt;/ui-select&gt;
  </code></pre>
  
  <p>And in my controller:</p>
  
  <pre><code>$scope.addRecipient = {}; 
  $scope.addRecipients =  [];
  $.each(success.data.d.results, function (ind, val) {
    $scope.addRecipients.push({'name': val.Title, 'email':val.Email});
  }); 
  </code></pre>
  
  <p>I can see the options to select in my select, however every time I click in any option, I get that error. Here is the dropdown showing the info from success.data.d.results:</p>
  
  <p><img src="https://i.stack.imgur.com/Ymkqe.png" alt="dropdown"></p>