Commit 864e1fb9 authored by Romain Bioteau's avatar Romain Bioteau Committed by benjaminparisel

fix(select) avoid setting value to null (#2647)

             * Was happening when referencing a External API variable. Value was set
             to null if not found among the availableValues by a watcher. But it was
             not reevaluated when the value was updated (external api call finished).

             Closes UID-38
parent b2facb08
......@@ -26,11 +26,7 @@ function PbSelectCtrl($scope, $parse, $log, widgetNameFactory, $timeout, $window
this.setSelectedValue = function (foundItem) {
$timeout(function () {
if (angular.isDefined(foundItem)) {
$scope.properties.value = foundItem;
} else {
$scope.properties.value = null;
}
$scope.properties.value = angular.isDefined(foundItem) ? foundItem : null ;
}, 0);
};
......@@ -58,11 +54,7 @@ function PbSelectCtrl($scope, $parse, $log, widgetNameFactory, $timeout, $window
var items = $scope.properties.availableValues;
if (Array.isArray(items)) {
var foundItem = ctrl.findSelectedItem(items);
$timeout(function () {
if (!angular.isDefined(foundItem)) {
$scope.properties.value = null;
}
}, 0);
ctrl.setSelectedValue(foundItem);
}
}
});
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment