angular-ui/ui-select2 — pull request #177 by stereosteve (2014-03-17 21:35:13+00:00)
Title: Enable watching on nested ng-repeats.

For the case when you have two nested ng-repeats: an outer one for `optgroup` and an inner repeat for the `option`s.

For example:

```js
// using underscore's groupBy function
$scope.groupedCities = _.groupBy(cities, 'state')
```

```html

{{ city.name }}

```

The current implementation only looks for `ng-repeat` on an option element - in this case it causes a scoping issue, because cities is only defined inside of the parent `ng-repeat`. As a result the initial value would not be set correctly.

This change caused an error to sometimes be thrown on this line:

```js
// Set initial value - I'm not sure about this but it seems to need to be there
elm.select2('data', controller.$modelValue);
```

Removing it fixed the problem - all the tests pass and everything worked correctly, but I didn't figure out why.

I can add a test for nested `ng-repeat` just wanted to get some feedback first...