Dropdown list not showing in the first rendering
Hello all,
When I the drop down is rendered the first time, when pressing the arrow and wanting to display the list, the list is not opened and I see in the debugger : ng-show="$select.items.length > 0".
In the class attribute I indeed see the 'ng-hide' class but what I can see too is that the list is populated and $select.items.length >0.
Why in the first time, it is thought that $select.items.length == 0?
The rest call for the list is asynchronous, but the list was populate at last so why the binding didn't work?
Thanks!
I have the same issue... I have even tried manually running $scope.$apply() after verifying that $scope.$select.items.length > 0 and the ng-hide class doesn't get removed for some reason. Any ideas?
Same issue here.
Angular 1.3 changed how evalAsync behaves: http://www.bennadel.com/blog/2751-scope-applyasync-vs-scope-evalasync-in-angularjs-1-3.htm
The following:
ngModel.$render = function() {
// Make sure that model value is array
if(!angular.isArray(ngModel.$viewValue)){
// Have tolerance for null or undefined values
if(angular.isUndefined(ngModel.$viewValue) || ngModel.$viewValue === null){
$select.selected = [];
} else {
throw uiSelectMinErr('multiarr', "Expected model value to be array but got '{0}'", ngModel.$viewValue);
}
}
$select.selected = ngModel.$viewValue;
scope.$evalAsync(); //To force $digest
};
should use $applyAysnc() instead to force the $digest cycle.