This repository was archived by the owner on Feb 19, 2025. It is now read-only.

Description
I had a controller that needed to initialize a ui-select2 from data that would be fetched from a service. The controller basically did this:
`$scope.allprojects=Project.query({'scope':'all'});`
The partial was written like this:
<select ui-select2 ng-model='project'>
<option ng-repeat='proj in allprojects' value="{{proj._id}}">{{proj.name}}</option>
</select>
It had strange inconsistent results. Sometimes it worked fine.
- The menu would be empty to start and would be wide enough to hold my widest project string.
- The menu would default to the first item in the project list.
- The model would track changes in the ui-sliders.
Most of the time it would fail:
- The menu would be very narrow, just showing me the triangle.
- There was no item selected at startup.
- If I opened the ui-select2 I would see the list of projects, and I was able to select them, but my model wouldn't update.
I worked around the problem by adding a:
Project
choice before the repeating clause.
That would initialize to the word "Project", but I noticed the menu was only as wide as the word "Project" not the widest choice. If I selected a wider choice the menu would resize. The model would update correctly as the menu changed.
I hope that's enough information for you to diagnose with.