ui-select2
ui-select2 copied to clipboard
Options can not be altered after the first digest, aka: doesn't work with promises
http://plnkr.co/edit/hcaZXka0BAzWzuzF9QgF?p=preview
The following code doesn't init properly the ui-select2 and it resets $scope.model.myVal to undefined.
$scope.model.myVal = 'foo'
$scope.values = Values.query()
<select ui-select2 ng-model="model.myVal" data-placeholder="Select a value">
<option value=""></option>
<option ng-repeat="v in values" value="{{v.id}}">{{v.name}}</option>
</select>
while this will work as expected:
$scope.model.myVal = 'foo'
Values.query(function (res) {
$scope.values = res
})
It's because it is watched for the array to change, not the items inside the array. It is some kind of memory waste if you make a new array everytime the options change, but the garbage collector should handle it. Maybe #154 will fix it, but I don't know if it doesn't affect other functionalities?!