angular-ui/ui-select — pull request #259 by tvervest (2014-10-05 22:45:15+00:00)
Title: Bug fix preventing errors when using async resources

If the select directive is supplied a resource promise (such as the $resource class from angular itself) a series of errors are occur when the library initialises. The following errors occur if the ui-select-choices directive is given a repeat expression using a $resource result;
```
Error: [$interpolate:interr] Can't interpolate: {{$select.getPlaceholder()}}
TypeError: Cannot read property 'length' of undefined
http://errors.angularjs.org/1.2.25/$interpolate/interr?p0=%7B%7B%24select.g…%7D&p1=TypeError%3A%20Cannot%20read%20property%20'length'%20of%20undefined
at http://localhost:3000/components/angular/angular.js:78:12
at Object.$interpolate.fn (http://localhost:3000/components/angular/angular.js:8849:26)
at Scope.$digest (http://localhost:3000/components/angular/angular.js:12532:40)
at Scope.$apply (http://localhost:3000/components/angular/angular.js:12805:24)
at done (http://localhost:3000/components/angular/angular.js:8378:45)
at completeRequest (http://localhost:3000/components/angular/angular.js:8592:7)
at XMLHttpRequest.xhr.onreadystatechange (http://localhost:3000/components/angular/angular.js:8531:11) angular.js:10071
```
```
TypeError: Cannot read property 'length' of undefined
at http://localhost:3000/components/ui-select/dist/select.js:563:36
at http://localhost:3000/components/angular/angular.js:17744:15
at forEach (http://localhost:3000/components/angular/angular.js:325:18)
at $setViewValue (http://localhost:3000/components/angular/angular.js:17743:5)
at http://localhost:3000/components/ui-select/dist/select.js:702:21
at Object.$watchCollectionAction [as fn] (http://localhost:3000/components/angular/angular.js:12409:13)
at Scope.$digest (http://localhost:3000/components/angular/angular.js:12540:29)
at Scope.$apply (http://localhost:3000/components/angular/angular.js:12805:24)
at done (http://localhost:3000/components/angular/angular.js:8378:45)
at completeRequest (http://localhost:3000/components/angular/angular.js:8592:7) angular.js:10071
```
```
Error: [$interpolate:interr] Can't interpolate: {{$select.getPlaceholder()}}
TypeError: Cannot read property 'length' of undefined
http://errors.angularjs.org/1.2.25/$interpolate/interr?p0=%7B%7B%24select.g…%7D&p1=TypeError%3A%20Cannot%20read%20property%20'length'%20of%20undefined
at http://localhost:3000/components/angular/angular.js:78:12
at Object.$interpolate.fn (http://localhost:3000/components/angular/angular.js:8849:26)
at Scope.$digest (http://localhost:3000/components/angular/angular.js:12532:40)
at Scope.$apply (http://localhost:3000/components/angular/angular.js:12805:24)
at done (http://localhost:3000/components/angular/angular.js:8378:45)
at completeRequest (http://localhost:3000/components/angular/angular.js:8592:7)
at XMLHttpRequest.xhr.onreadystatechange (http://localhost:3000/components/angular/angular.js:8531:11)
```
I've added some additional checks which prevent the uninitialised variables from being used, resolving the issue altogether :)

**Note:** my work is based on a fork of @juanpasolano's fork, so it also includes his patches in #198