GUAC-586: Ensure model is set prior to region in time zone field.

This commit is contained in:
Michael Jumper
2015-08-28 22:57:57 -07:00
parent cff2b7a857
commit 83318d9c68

View File

@@ -697,15 +697,15 @@ angular.module('form').controller('timeZoneFieldController', ['$scope', '$inject
*/
$scope.region = '';
// Restore time zone selection when region changes
$scope.$watch('region', function restoreSelection(region) {
$scope.model = selectedTimeZone[region] || null;
});
// Ensure corresponding region is selected
$scope.$watch('model', function setModel(model) {
$scope.region = timeZoneRegions[model] || '';
selectedTimeZone[$scope.region] = model;
});
// Restore time zone selection when region changes
$scope.$watch('region', function restoreSelection(region) {
$scope.model = selectedTimeZone[region] || null;
});
}]);